Answer the question
In order to leave comments, you need to log in
If the server is running for a long time, then Node devours all the memory?
What could be the reason? Gradually, my RAM is simply eaten by the node process, or it does not have enough memory and the server crashes with an error.
My webpack config:
-
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']
}
}
}
]
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question