提交 f8e1cc20 编写于 作者: fxy060608's avatar fxy060608

fix(h5): easycom with tree shaking

上级 727408cc
......@@ -35,7 +35,13 @@ const {
module.exports = {
compile (source, options = {}) {
(options.modules || (options.modules = [])).push(autoComponentsModule)
if ( // 启用摇树优化后,需要过滤内置组件
!options.autoComponentResourcePath ||
options.autoComponentResourcePath.indexOf('@dcloudio/uni-h5/src') === -1
) {
(options.modules || (options.modules = [])).push(autoComponentsModule)
}
options.isUnaryTag = isUnaryTag
// 将 autoComponents 挂在 isUnaryTag 上边
options.isUnaryTag.autoComponents = new Set()
......@@ -257,4 +263,4 @@ at ${resourcePath}.vue:1`)
ssrCompile,
ssrCompileToFunctions,
generateCodeFrame
}
}
......@@ -77,8 +77,13 @@ module.exports = function (source) {
if (options.isH5TreeShaking) { // 摇树优化逻辑(框架组件移除样式,禁用 modules)
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
if(options.compilerOptions){
options.compilerOptions = {}
}
options.compilerOptions.autoComponentResourcePath = normalizePath(resourcePath)
// fixed by xxxxxx
if(!modules && options.compilerOptions && options.compilerOptions.modules){
modules = options.compilerOptions.modules
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册