admin管理员组文章数量:1123054
Im using next 14 and i wanted to enable tree-shaking which i found that i have to enable usedExports in the webpack which lead to this config:
webpack: (config, { isServer }) => {
if (!isServer) {
// don't resolve 'fs' module on the client to prevent this error on build --> Error: Can't resolve 'fs'
config.resolve.fallback = {
fs: false,
}
config.plugins = [...config.plugins, new PrismaPlugin()]
}
config.optimization.usedExports = true
config.optimization.minimizer = [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
terserOptions: {
mangle: {
// older versions of node-fetch requires AbortSignal to be untouched.
//
reserved: ["AbortSignal"],
},
},
}),
]
return config
},
}
And this happend:
Error: optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect
I even tryed to disable cacheUnaffected
but it said that the config is invalid:
config.cache.cacheUnaffected = false
Lead to :
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
本文标签:
版权声明:本文标题:next.js - Error: optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect - Stack 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736541930a1944395.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论