You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to figure out the best way to integrate Vue with a legacy JS framework that has its own build process and its own index.html file (which has odd templating for including dev resources vs prod resources).
I previously got this working using vue-cli. I was able to conditionally include JavaScript and CSS in my index.html file using the NODE_ENV environment variable and those resources were loaded using the devServer proxy (since they are not located in the Vue project dir):
This worked great for both the dev mode and production build. After building, the generated index.html which has the injected vue script tags is then copied over into our legacy JS framework's prod build
With vite, I thought I could accomplish the same thing but I don't know how to use environment variables in the index.html page. Also, even if I just hard-code <link rel="stylesheet" href="prod.css"> without the NODE_ENV condition, vite tries to process this file which is not located in the Vue project dir and it errors out***. I don't want vite to try and process the legacy framework's files.
It may be easier if I can simply use a different index.html file for dev vs prod build. Is that possible?
*** There's a slight bug in the error message when a file is not found. It strips the first character of the filename, e.g. rod.css instead of prod.css:
vite v1.0.0-rc.4
⠋ Building for production...
[vite] Build errored out.
[Error: ENOENT: no such file or directory, open '/projects/abc/web-app/vue/rod.css'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/projects/abc/web-app/vue/rod.css'
}
The text was updated successfully, but these errors were encountered:
I'm trying to figure out the best way to integrate Vue with a legacy JS framework that has its own build process and its own index.html file (which has odd templating for including dev resources vs prod resources).
I previously got this working using vue-cli. I was able to conditionally include JavaScript and CSS in my index.html file using the NODE_ENV environment variable and those resources were loaded using the devServer proxy (since they are not located in the Vue project dir):
This worked great for both the dev mode and production build. After building, the generated index.html which has the injected vue script tags is then copied over into our legacy JS framework's prod build
With vite, I thought I could accomplish the same thing but I don't know how to use environment variables in the index.html page. Also, even if I just hard-code
<link rel="stylesheet" href="prod.css">
without the NODE_ENV condition, vite tries to process this file which is not located in the Vue project dir and it errors out***. I don't want vite to try and process the legacy framework's files.It may be easier if I can simply use a different index.html file for dev vs prod build. Is that possible?
*** There's a slight bug in the error message when a file is not found. It strips the first character of the filename, e.g.
rod.css
instead ofprod.css
:The text was updated successfully, but these errors were encountered: