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
微信小程序
小程序基础库: 2.14.4 使用框架: React
项目整体是taro项目 分包packageC里全是原生小程序结构,打包后packageC里的util文件被打包到了common.js。我通过设置cachegroups和addChunkPages抽离分包公共文件 但是重新打包后进入分包页面时报错VM5800 WAService.js:2 SyntaxError: Unexpected identifier SyntaxError: Unexpected token export
正常进入分包
报错了。
👽 Taro v2.2.11 Taro CLI 2.2.11 environment info: System: OS: macOS 10.14 Shell: 3.2.57 - /bin/bash Binaries: Node: 12.3.1 - /usr/local/bin/node npm: 6.14.10 - /usr/local/bin/npm npmPackages: @tarojs/cli: 2.2.11 => 2.2.11 @tarojs/components: 2.2.11 => 2.2.11 @tarojs/mini-runner: 2.2.11 => 2.2.11 @tarojs/plugin-babel: 2.2.11 => 2.2.11 @tarojs/plugin-csso: 2.2.11 => 2.2.11 @tarojs/plugin-sass: 2.2.11 => 2.2.11 @tarojs/plugin-uglify: ^2.2.7 => 2.2.10 @tarojs/redux: 2.2.11 => 2.2.11 @tarojs/redux-h5: 2.2.11 => 2.2.11 @tarojs/router: 2.2.11 => 2.2.11 @tarojs/taro: 2.2.11 => 2.2.11 @tarojs/taro-alipay: 2.2.11 => 2.2.11 @tarojs/taro-h5: 2.2.11 => 2.2.11 @tarojs/taro-swan: 2.2.11 => 2.2.11 @tarojs/taro-tt: 2.2.11 => 2.2.11 @tarojs/taro-weapp: 2.2.11 => 2.2.11 @tarojs/webpack-runner: 2.2.11 => 2.2.11 eslint-config-taro: 2.2.11 => 2.2.11 eslint-plugin-taro: 2.2.11 => 2.2.11 nerv-devtools: ^1.5.7 => 1.5.7 nervjs: ^1.5.7 => 1.5.7 taro-ui: ^2.2.1 => 2.3.4
The text was updated successfully, but these errors were encountered:
目测配错了,可以上个 demo 看看
Sorry, something went wrong.
webpackChain(chain, webpack) { chain.merge({ optimization: { splitChunks: { cacheGroups: { ddd:{ name: "packageC/ddds", priority: 1000, test(module) { if ( /src[\\/]packageC[\\/]utils/.test(module.resource) ) { return true; } }, }, lodash: { name: "lodash", priority: 1000, test(module) { return /node_modules[\\/]lodash/.test(module.context); } }, moment: { name: "date-fns", priority: 1000, test(module) { return /node_modules[\\/]date-fns/.test(module.context); } } } } } }) // if (isPro) { // chain.plugin('analyzer') // .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) // } chain.plugin('IgnorePlugin') .use(webpack.IgnorePlugin, [/^\.\/locale$/, /date-fns$/]) chain.plugin('LodashModuleReplacementPlugin') .use(require('lodash-webpack-plugin'), [{ 'coercions': true, 'paths': true }]) }, addChunkPages(pages, pagesNames) { pages.set("packageC/pages", ["ddd"]); }, 以上packageC相关和addchunkpages是我配置的。
webpackChain(chain, webpack) { chain.merge({ optimization: { splitChunks: { cacheGroups: { ddd:{ name: "packageC/ddds", priority: 1000, test(module) { if ( /src[\\/]packageC[\\/]utils/.test(module.resource) ) { return true; } }, }, lodash: { name: "lodash", priority: 1000, test(module) { return /node_modules[\\/]lodash/.test(module.context); } }, moment: { name: "date-fns", priority: 1000, test(module) { return /node_modules[\\/]date-fns/.test(module.context); } } } } } }) // if (isPro) { // chain.plugin('analyzer') // .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) // } chain.plugin('IgnorePlugin') .use(webpack.IgnorePlugin, [/^\.\/locale$/, /date-fns$/]) chain.plugin('LodashModuleReplacementPlugin') .use(require('lodash-webpack-plugin'), [{ 'coercions': true, 'paths': true }]) }, addChunkPages(pages, pagesNames) { pages.set("packageC/pages", ["ddd"]); },
const PKGCChunkName = 'packageC/subCommon'; addChunkPages(pages, pagesNames) { pages.set("packageC/pages/edit_post/edit_post", [PKGCChunkName]); }, webpackChain(chain, webpack) { chain.merge({ optimization: { splitChunks: { cacheGroups: { PKGCChunkName:{ name: PKGCChunkName, priority: 1000, test(module) { if ( /src[\\/]packageC[\\/]utils/.test(module.resource) ) { return true; } }, },
webpackChain(chain, webpack) { chain.merge({ optimization: { splitChunks: { cacheGroups: { PKGCChunkName:{ name: PKGCChunkName, priority: 1000, test(module) { if ( /src[\\/]packageC[\\/]utils/.test(module.resource) ) { return true; } }, },
No branches or pull requests
相关平台
微信小程序
小程序基础库: 2.14.4
使用框架: React
复现步骤
项目整体是taro项目 分包packageC里全是原生小程序结构,打包后packageC里的util文件被打包到了common.js。我通过设置cachegroups和addChunkPages抽离分包公共文件 但是重新打包后进入分包页面时报错VM5800 WAService.js:2 SyntaxError: Unexpected identifier SyntaxError: Unexpected token export
期望结果
正常进入分包
实际结果
报错了。
环境信息
The text was updated successfully, but these errors were encountered: