Skip to content

Commit c320977

Browse files
committed
wip(build): add webpack configuration names
This allow to use `--config-name` flag to select builds to launch. https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations
1 parent 5c1ad03 commit c320977

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

build/webpack.config.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ const pkg = require('../package.json');
1616

1717
const distPath = Path.resolve(__dirname, '..', 'dist');
1818

19-
const configure = ({vueVersion}) => (env = {}, { mode = 'production' }) => {
19+
const configure = ({name, vueVersion}) => (env = {}, { mode = 'production', configName }) => {
20+
if (configName && configName.includes(name)) {
21+
return {name}
22+
}
23+
2024
const isProd = mode === 'production';
2125

2226
// doc: https://github.com/browserslist/browserslist#full-list
@@ -32,6 +36,7 @@ const configure = ({vueVersion}) => (env = {}, { mode = 'production' }) => {
3236
console.log('config', { targetsBrowsers, noPresetEnv, noCompress, genSourcemap, vueVersion });
3337

3438
return {
39+
name,
3540
entry: [
3641
'regenerator-runtime',
3742
Path.resolve(__dirname, '../src/index.ts'),
@@ -298,9 +303,9 @@ ${ pkg.name } v${ pkg.version }
298303
}
299304
}
300305

301-
configs = [
302-
{vueVersion: "2"},
303-
{vueVersion: "3"}
306+
let configs = [
307+
{name: 'vue2', vueVersion: '2' },
308+
{name: 'vue3', vueVersion: '3' }
304309
]
305310

306311
module.exports = configs.map(configure)

0 commit comments

Comments
 (0)