We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dcloudio版本:2.0.2-4010520240507001 项目类型:mp-weixin vue.config.js配置:
configureWebpack: { cache: { type: 'filesystem', // cacheDirectory: path.resolve(__dirname, '.temp_cache'), profile: true, }, }
使用webpack的文件缓存
当使用webpack5的内置文件缓存时,会出现usingComponents为空的状态,文件内容如下 上述中使用过组件,但是usingComponent为空
当使用webpack5的内置缓存时会执行webpack/lib/Compilation.js
_buildModule(module, callback) { module.needBuild( { compilation: this, fileSystemInfo: this.fileSystemInfo, valueCacheVersions: this.valueCacheVersions }, (err, needBuild) => { if (err) return callback(err); if (!needBuild) { } } ) }
上述中因为使用内置缓存,所以needBuild会为false,导致会不会触发@dcloudio/webpack-uni-mp-loader/lib/script-new.js的loader 所以不会触发下面的代码逻辑
components.forEach(({ name, source }) => { usingComponents[name] = `/${source}` }) updateUsingComponents(resourcePath, usingComponents, type, content)
上述逻辑是识别内部使用到的组件,将组件生成usingComponents更新json对象 而jsonFile在内置的@dcloudio/uni-cli-shared/lib/cache.js中存储json对象 let jsonFileMap = new Map() 因为没有将这个字段在webpack的打包配置中进行缓存,导致打包中json对象的usingComponent字段会为空。 而webpack缓存不会触发loader,所以也不会更新json对象的usingComponent字段。 导致最终写入json文件的时候usingComponent字段不存在。 如果上述有逻辑理解问题可以指明
let jsonFileMap = new Map()
支持使用webpack5缓存进行编译
The text was updated successfully, but these errors were encountered:
No branches or pull requests
项目信息
dcloudio版本:2.0.2-4010520240507001
项目类型:mp-weixin
vue.config.js配置:
使用webpack的文件缓存
问题描述
当使用webpack5的内置文件缓存时,会出现usingComponents为空的状态,文件内容如下
上述中使用过组件,但是usingComponent为空
问题相关调研
当使用webpack5的内置缓存时会执行webpack/lib/Compilation.js
上述中因为使用内置缓存,所以needBuild会为false,导致会不会触发@dcloudio/webpack-uni-mp-loader/lib/script-new.js的loader
所以不会触发下面的代码逻辑
上述逻辑是识别内部使用到的组件,将组件生成usingComponents更新json对象
而jsonFile在内置的@dcloudio/uni-cli-shared/lib/cache.js中存储json对象
let jsonFileMap = new Map()
因为没有将这个字段在webpack的打包配置中进行缓存,导致打包中json对象的usingComponent字段会为空。
而webpack缓存不会触发loader,所以也不会更新json对象的usingComponent字段。
导致最终写入json文件的时候usingComponent字段不存在。
如果上述有逻辑理解问题可以指明
诉求
支持使用webpack5缓存进行编译
The text was updated successfully, but these errors were encountered: