Skip to content

Support for multiple webpack configurations #2613

Open
@thestonehead

Description

@thestonehead

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

configureWebpack: config => {
       // code that alters config1 and config2 based on config argument...
       return [config1, config2]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions