Skip to content

Commit

Permalink
fix(mini-runner): 打包优化,引用自 npm 包中的组件不抽离至 vendors 中
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jan 7, 2020
1 parent c4df170 commit 4ecdb24
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/taro-mini-runner/src/webpack/build.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
mergeOption,
getMiniPlugin
} from './chain'
import { BUILD_TYPES } from '../utils/constants'
import { BUILD_TYPES, PARSE_AST_TYPE } from '../utils/constants'
import { Targets } from '../plugins/MiniPlugin'

const emptyObj = {}
Expand Down Expand Up @@ -139,7 +139,14 @@ export default (appPath: string, mode, config: Partial<IBuildConfig>): any => {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 0,
name: 'vendors'
name: 'vendors',
cacheGroups: {
vendors: {
test (module) {
return /[\\/]node_modules[\\/]/.test(module.resource) && module.miniType !== PARSE_AST_TYPE.COMPONENT
}
}
}
}
}
})
Expand Down

0 comments on commit 4ecdb24

Please sign in to comment.