-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Support for multiple webpack configurations #2613
Comments
It should be possible to implement this in a functional way as a plugin in userland. I'm not sure that we should add this to the Core build process since I'm afraid it would take a pretty big refactoring to get it into the build process en par with the other options, in my eyes. |
I had the same need in a real world project. What I did is tweak the webpack configuration into multiple configs after it is resolved by vue cli. It's simple but a bit hacky. I have extracted my usage into a plugin in case anyone needs: vue-cli-plugin-multi-compiler. More details can be found in that repo. |
I have exactly the same need, trying to transpile my test files, each of them requires individual webpack entry (to be standalone). Previously I've solved that by using multiple Webpack configs, but now I'm puzzled. Going to try the @jkzing plugin. |
@jkzing 's plugin works great. However, as mentioned here jkzing/vue-cli-plugin-multi-compiler#1, the If that is the only place where such assumption is made (the plugin works fine in production build), then its not such a big change to sources. @LinusBorg Please consider adding this feature, or, can you give recommendations how to implement it in userland for development builds? |
Just adding my two cents here to say that I'm trying to use webpack to bundle my server-side code into |
still no luck about @vue/cli's |
I've been trying using multiple config using but there are several implications in vue-loader checking for config, looking for appropriate loader. as i don't know the strategy behind this and can't find documents justifying for such... i guess we have not choice but to say "it's impossible to do so ; it's a limitation of @vue/cli" |
What problem does this feature solve?
For my application, I need support for color schemes. I have solved this by using scss file with variables that gets imported wherever there's a need for color. E.g. variables.ThemeA.scss and variables.ThemeB.scss are color schemes supported. Then it's just a matter of linking to one or another at runtime.
Before vue-cli, this was resolved using webpack support for multiple configurations (https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations). After vue-cli this can't be solved as vue.config.js works only with a single configuration.
Current workaround is doing this in package.json:
"buildThemes": "set VUE_THEME=ThemeA && vue-cli-service build && set VUE_THEME=ThemeB && vue-cli-service build --no-clean",
And then using that environment variable in vue.config.js configureWebpack() method.
What does the proposed API look like?
Support for returning an array in configureWebpack method in vue.config.js
The text was updated successfully, but these errors were encountered: