Skip to content

Commit

Permalink
perf(h5): 加快 h5 webpack 构建速度 (#6102)
Browse files Browse the repository at this point in the history
* perf(h5): 优化 h5 webpack 打包速度

* perf(taro-components): 父子组件打包到同一文件
  • Loading branch information
Chen-jj authored Apr 24, 2020
1 parent b7a639a commit 66f2ec6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/taro-components/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export const config: Config = {
esmLoaderPath: '../loader'
}
],
bundles: [
{ components: ['taro-picker-core', 'taro-picker-group'] },
{ components: ['taro-checkbox-core', 'taro-checkbox-group-core'] },
{ components: ['taro-radio-core', 'taro-radio-group-core'] },
{ components: ['taro-swiper-core', 'taro-swiper-item-core'] },
{ components: ['taro-video-core', 'taro-video-control', 'taro-video-danmu'] }
],
excludeSrc: ['/test/', '**/.spec.', '/types/', '*.d.ts'],
testing: {
testRegex: '(/__tests__/.*|(\\.|/)(tt|spec))\\.[jt]sx?$',
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-h5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@tarojs/taro-h5",
"version": "3.0.0-beta.5",
"description": "Taro h5 framework",
"main:h5": "src/index.js",
"main:h5": "dist/index.mjs.js",
"main": "dist/index.cjs.js",
"typings": "types/index.d.ts",
"files": [
Expand Down
6 changes: 6 additions & 0 deletions packages/taro-h5/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ const variesConfig = [{
output: {
file: 'dist/index.cjs.js'
}
}, {
input: 'src/index.js',
output: {
format: 'es',
file: 'dist/index.mjs.js'
}
}]

export default variesConfig.map(v => {
Expand Down
5 changes: 4 additions & 1 deletion packages/taro-webpack-runner/src/util/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,11 @@ export const getModule = (appPath: string, {
}
rule.script = {
test: REG_SCRIPTS,
exclude: [filename => /node_modules/.test(filename)],
use: {
babelLoader: getBabelLoader([{}])
babelLoader: getBabelLoader([{
compact: false
}])
}
}
rule.media = {
Expand Down

0 comments on commit 66f2ec6

Please sign in to comment.