В чем может быть причина? Постепенно моя оперативка просто поедается процессом node, либо ей не хватает памяти и сервак вылетает с ошибкой.
Мой конфиг вебпака:
-
const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
const CopyPlugin = require("copy-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: {
main: ['@babel/polyfill', '/app.js'],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/[name].js'
},
watchOptions: {
aggregateTimeout: 200,
poll: 1000,
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: 'css/[name].css',
}),
new BrowserSyncPlugin({
proxy: 'wp-webpack/',
host: 'wp-webpack/',
snippetOptions: {
ignorePaths: "/wp-admin/**"
},
files: '**/**/**.php',
reload: true,
}),
new CopyPlugin({
patterns: [
{ from: "images", to: "images" },
{ from: "fonts", to: "fonts" },
],
}),
new BundleAnalyzerPlugin()
],
module: {
rules: [
{
test: /\.css$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
require('autoprefixer'),
],
},
},
},
],
},
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
require('autoprefixer'),
],
},
},
},
"sass-loader",
],
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
type: 'asset/resource',
generator: {
filename: './images/[name][ext]',
},
},
{
test: /\.(ttf|woff|woff2)$/,
type: 'asset/resource',
generator: {
filename: './fonts/[name][ext]',
},
},
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
}
}