Skip to content

taro 分包加载echarts时 打包到主包(common.js) 而非分包, 请问该如何配置 #7892

New issue

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

Closed
tzzqi opened this issue Oct 21, 2020 · 2 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-2 Version - 2.x

Comments

@tzzqi
Copy link

tzzqi commented Oct 21, 2020

相关平台

微信小程序

小程序基础库: 2.11.0
使用框架: React

复现步骤

添加subpackages配置

期望结果

我希望能把echarts等微信原生组件 打包到分包 而非主包

实际结果

打包到主包(dist上显示合并common.js) 而非分包

环境信息

� Taro v2.1.3


  Taro CLI 2.1.3 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 12.16.2 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.4 - E:\Software\nodejs\node_global\yarn.CMD
      npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD

补充信息

mini: {
postcss: {

},
webpackChain (chain) {
  const config = chain.optimization.get('splitChunks')
  chain.optimization
    .splitChunks({
      ...config,
      cacheGroups: {
        ...config.cacheGroups,
        subutils: {
          name: 'packageA/ec-canvas',
          minChunks: 2,
          test: module => /packageA[\\/]ec-canvas[\\/]/.test(module.resource),
          priority: 200
        }
      }
    })
},
addChunkPages (pages) {
  pages.set('packageA/pages/statisticInfo/index', ['packageA/ec-canvas'])
},

},

试过上面配置 echarts能打包进分包 但是目录不对

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-2 Version - 2.x labels Oct 21, 2020
@tzzqi tzzqi closed this as completed Oct 23, 2020
@moreandmoreyuan
Copy link

请问解决了吗

@wozien
Copy link

wozien commented Feb 20, 2023

mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-2 Version - 2.x
Projects
None yet
Development

No branches or pull requests

3 participants