Имеется конфиг для webpack:
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const path = require("path");
module.exports = () => ({
devtool: "nosources-source-map",
output: {
sourceMapFilename: "themes/[name]/js/source_map.map",
},
module: {
rules: [
{
test: /\.(svg|ttf|woff|woff2|eot|jpe?g|png|gif)$/,
use: [
{
loader: "file-loader",
options: {
name: '[path][name].[ext]'
}
}
]
}
]
},
plugins: [
new CleanWebpackPlugin(path.resolve(__dirname, '../static/build'), {allowExternal: true}),
new OptimizeCssAssetsPlugin({cssProcessorOptions: {discardComments: {removeAll: true}}}),
new UglifyJsPlugin({sourceMap: true})
],
performance: {
hints: false
}
});
После запуска проходить n времени и вылетает ошибка:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::DecodeWrite
2: node_module_register
3: v8::internal::FatalProcessOutOfMemory
4: v8::internal::FatalProcessOutOfMemory
5: v8::internal::Factory::NewFixedArray
6: v8::internal::HashTable<v8::internal::SeededNumberDictionary,v8::internal::SeededNumberDictionaryShape>::NewInternal
7: v8::internal::HashTable<v8::internal::SeededNumberDictionary,v8::internal::SeededNumberDictionaryShape>::EnsureCapacity
8: v8::internal::Dictionary<v8::internal::SeededNumberDictionary,v8::internal::SeededNumberDictionaryShape>::Add
9: v8::internal::WasmDebugInfo::SetupForTesting
10: v8::internal::WasmDebugInfo::SetupForTesting
11: v8::internal::SharedFunctionInfo::SetScript
12: v8::internal::JSReceiver::class_name
13: v8::internal::SourcePositionTableIterator::Advance
14: v8::internal::SourcePositionTableIterator::Advance
15: 0000015449A843C1
Как можно пофиксить?
P.s. в devtool обязательно должно быть nosources-source-map
Спасибо за ответы Pavel Mayorov и overthesanity.
Для увеличения лимита памяти webpack нужно было добавить NODE_OPTIONS=--max_old_space_size=8192 в файле package.json.
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости