Replies: 1 comment
|
Umi4 底层使用 webpack,可以通过 方法 1:通过 在 export default {
chainWebpack(config) {
// 添加自定义 condition,同时保留默认值
config.resolve.conditionNames
.add('my-custom-condition')
// webpack 默认值需要手动保留,否则会被覆盖
// 默认包含: import, module, webpack, development/production, browser
;
return config;
},
};如果你需要完全控制 conditionNames 的顺序,可以用 export default {
chainWebpack(config) {
// 清除后重新设定完整列表
config.resolve.conditionNames.clear();
['require', 'import', 'module', 'webpack', 'browser', 'default'].forEach(name => {
config.resolve.conditionNames.add(name);
});
return config;
},
};方法 2:如果你同时使用了 Mako 打包器 需要注意 补充说明 webpack 的 如果能说明一下你具体的使用场景(哪个依赖包的 exports 没有按预期解析) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
https://webpack.js.org/configuration/resolve/#resolveconditionnames
All reactions