diff --git a/packages/uni-template-compiler/lib/index.js b/packages/uni-template-compiler/lib/index.js index 920a9da232a76028c131b180b327ce287acaf9f0..c9b0280d3330ef8e43165afb9d8ed2e572bb881c 100644 --- a/packages/uni-template-compiler/lib/index.js +++ b/packages/uni-template-compiler/lib/index.js @@ -38,7 +38,11 @@ const isWin = /^win/.test(process.platform) const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path) module.exports = { - compile (source, options = {}) { + compile (source, options = {}) { + if (Array.isArray(options.modules)) { + options.modules.push(compilerModuleUniad) + } + if ( // 启用摇树优化后,需要过滤内置组件 !options.autoComponentResourcePath || options.autoComponentResourcePath.indexOf('@dcloudio/uni-h5/src') === -1 @@ -48,8 +52,6 @@ module.exports = { if (!options.modules) { options.modules = [] } - - options.modules.push(compilerModuleUniad) // transformAssetUrls options.modules.push(require('./asset-url'))