Skip to content
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

【BUG】前端开启代码拆分后,Yarn build后混合布局的样式错乱 #189

Open
kurumii opened this issue Jun 20, 2024 · 2 comments
Assignees

Comments

@kurumii
Copy link

kurumii commented Jun 20, 2024

操作步骤:
步骤一:vite.config.js开启以下代码

      rollupOptions: {
        output: {
          manualChunks(id) {
            if (id.includes('node_modules')) {
              return id.toString().split("node_modules/")[1].split("/")[0].toString();
            }
          }
        }
      }

步骤二:执行yarn build命令
步骤三:进入后台,切换布局为混合
步骤四:布局异常
1718862419973

@zds-s zds-s assigned zds-s and kanyxmo and unassigned zds-s Jun 20, 2024
@kanyxmo
Copy link
Member

kanyxmo commented Jun 20, 2024

估计拆分拆到大动脉了,等测试看看

@fankiewing
Copy link

fankiewing commented Aug 7, 2024

不要拆大动脉,参考:

`
const dependencies = require('./package.json').dependencies;

output: {
manualChunks(id) {
// 这个ID,就是所有文件的绝对路径
if (id.includes("node_modules")) {
// 指定需要拆分的第三方库或模块
const dependenciesKeys = Object.keys(dependencies);
const match = dependenciesKeys.find((item) => {
return id.includes(item);
});
const notSplit = ['vue', '@arco-design/web-vue', 'lodash'];
if (match && !notSplit.includes(match)) {
return match;
}
}
}
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants