Когда я запускаю npm run build
в своем приложении реакции, я получаю следующее предупреждение: static/js/widget.js contains invalid source map
.
Когда я удаляю настройки UglifyJs в конфигурации моего веб-пакета, процесс сборки проходит без каких-либо предупреждений.
Мой конфиг Webpack (только те части, которые имеют отношение к исходной карте):
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
module.exports = {
// Don't attempt to continue if there are any errors.
bail: true,
mode: 'production',
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
devtool: shouldUseSourceMap ? 'source-map' : false,
...
plugins: [
new UglifyJsPlugin({
uglifyOptions: {
sourceMap: shouldUseSourceMap,
warnings: false,
compress: {
comparisons: false
},
output: {
comments: false,
ascii_only: true
},
}
}),
]