Skip to content

Commit 5c1ad03

Browse files
committed
wip(build): use parallel build for vue2/vue3
1 parent 6c29f3a commit 5c1ad03

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

build/webpack.config.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@ const pkg = require('../package.json');
1616

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

19-
module.exports = (env = {}, { mode = 'production' }) => {
20-
19+
const configure = ({vueVersion}) => (env = {}, { mode = 'production' }) => {
2120
const isProd = mode === 'production';
2221

2322
// doc: https://github.com/browserslist/browserslist#full-list
2423
// eg. '> 0.5%, last 2 versions, Firefox ESR, not dead, not ie 11'
2524
const {
2625
targetsBrowsers = 'defaults',
2726
noPresetEnv = !isProd,
28-
noCompress = !isProd,
29-
vueVersion = '3',
27+
noCompress = !isProd
3028
} = env;
3129

3230
const genSourcemap = false;
@@ -156,7 +154,7 @@ ${ pkg.name } v${ pkg.version }
156154
@description ${ pkg.description }.
157155
@author ${ pkg.author.name } <${ pkg.author.email }>
158156
@license ${ pkg.license }
159-
`.trim()),
157+
`.trim()),
160158
],
161159
resolve: {
162160
extensions: [".ts", ".js"],
@@ -300,3 +298,9 @@ ${ pkg.name } v${ pkg.version }
300298
}
301299
}
302300

301+
configs = [
302+
{vueVersion: "2"},
303+
{vueVersion: "3"}
304+
]
305+
306+
module.exports = configs.map(configure)

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"testVue2": "cd test && cross-env VUE_VERSION=2 yarn run start",
2525
"tests": "jest --runInBand \"tests/.*\\.test.js\"",
2626
"dev": "webpack --mode=development --config ./build/webpack.config.js --progress --watch",
27-
"build": "cross-env-shell webpack --mode=production --config ./build/webpack.config.js --progress --env targetsBrowsers=\\\"$npm_package_browserslist\\\" && cross-env-shell webpack --mode=production --config ./build/webpack.config.js --progress --env vueVersion=\\\"2\\\" --env targetsBrowsers=\\\"$npm_package_browserslist\\\"",
27+
"build": "cross-env-shell webpack --mode=production --config ./build/webpack.config.js --progress --env targetsBrowsers=\\\"$npm_package_browserslist\\\"",
2828
"docs": "cross-env-shell node build/evalHtmlComments.js README.md $npm_package_version && node build/evalHtmlComments.js docs/examples.md $npm_package_version && typedoc --plugin typedoc-plugin-markdown --mode file --tsconfig ./build/tsconfig.json --inputFiles ./src/index.ts --out ./docs/api --readme none --stripInternal --namedAnchors true",
2929
"pushDocs": "yarn run docs && git add docs/ && cross-env-shell git commit -m \\\"chore(docs): v$npm_package_version API docs & examples \\\" docs",
3030
"release": "standard-version --header \"\""
@@ -78,6 +78,7 @@
7878
"puppeteer": "^8.0.0",
7979
"source-map-explorer": "2.5.2",
8080
"standard-version": "^9.1.1",
81+
"terser-webpack-plugin": "^5.1.1",
8182
"ts-loader": "^8.0.17",
8283
"typedoc": "0.19.2",
8384
"typedoc-plugin-markdown": "3.1.1",

0 commit comments

Comments
 (0)