-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Building features on demand #948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
...or set the NODE_ENV accordingly in the env file Doesn't that do what you want it to?
I don't really understand this part. |
Ok, this work as I expected, but you have to admit this is a bit confusing. Having to set the environment to production and declaring
If I bundle my application with Screenshots for Basic server loading the index.html Anyways, it seems that with your first comment I can solve the problem of the bundle creation with the same production "features" but using other environment variables. I'm not closing this issue because I'd like to know if the proposed feature could be a good improvement to the build process. If that is not the case, feel free to close it or just tell me to do it. Thanks @LinusBorg |
You are supposed to add
Into your
|
All clear @yyx990803 ! |
I am using I have tried using:
I wonder what am I missing. |
If somebody else is having the same problem I did, I got it working by adding another script in the
|
@phcoliveira What command did you use to run your "build-staging"? I too tried many ways. Whatever I do, I see only either production or development ENV when running the index.html file in dist.
|
Uh oh!
There was an error while loading. Please reload this page.
What problem does this feature solve?
Build the application based on a set of a features instead of the current building environment.
I'm facing with a problem in the new
@vue/cli
. I want to create a staging environment for my company/application but I don't find a nice way to do it without override lots of line of default webpack configuration file.If I explicitly set the build mode (
--mode staging
), vue cli in fact gets the.env.staging
environment variables BUT it builds the bundle with development features (for example, it doesn't minify the code, it doesn't extract the CSS, etc ...)Futhermore, if I build the bundle using this command, as the documentation recommends
vue-cli-service build --mode development
, it just not work without being served by internal vue dev-server. The static assets like images or icons are not being extracted out the bundle (I suppose this is intended behaviour) but myapp.js
is requesting images via HTTP that doesn't exists in mydist
folder.What does the proposed API look like?
My proposal would be a way to abstract the core features available in
@vue/cli
to build against a set of required features instead of basing the build in the variableprocess.env.NODE_ENV
Of course, this behaviour can fallback in a pre-defined set of features by
NODE_ENV
if this list is not defined.One example, vue.config.js:
If this becomes in something, in a future this could be a good approach to create plugins with features that encapsulate any webpack behaviour under a good readable name.
Of course, this is just a draft and the behaviour/api could change to adapt to the current code or whatever. I'm sure that I'm forgetting/not getting something into account, but I hope my idea is a bit more understandable.
Cheers.
The text was updated successfully, but these errors were encountered: