Fix webpack memory leak when copying HTML files

(cherry picked from commit 2804a961cb457cc94d3eaa1fe8ee2f71d9d1261c)
This commit is contained in:
Mark McDowall 2021-05-18 23:22:34 -07:00 committed by Qstick
parent bdc7733faf
commit ba1637087e
4 changed files with 976 additions and 556 deletions

View File

@ -1,6 +1,6 @@
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const LiveReloadPlugin = require('webpack-livereload-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
@ -23,7 +23,7 @@ module.exports = (env) => {
const config = {
mode: isProduction ? 'production' : 'development',
devtool: 'source-map',
devtool: isProduction ? 'source-map' : 'eval-source-map',
stats: {
children: false
@ -87,46 +87,47 @@ module.exports = (env) => {
}),
new HtmlWebpackPlugin({
template: 'frontend/src/index.html',
template: 'frontend/src/index.ejs',
filename: 'index.html',
publicPath: '/'
}),
new CopyPlugin({
patterns: [
// HTML
{
from: 'frontend/src/*.html',
to: path.join(distFolder, '[name][ext]'),
globOptions: {
ignore: ['**/index.html']
}
},
new FileManagerPlugin({
events: {
onEnd: {
copy: [
// HTML
{
source: 'frontend/src/*.html',
destination: distFolder
},
// Fonts
{
from: 'frontend/src/Content/Fonts/*.*',
to: path.join(distFolder, 'Content/Fonts', '[name][ext]')
},
// Fonts
{
source: 'frontend/src/Content/Fonts/*.*',
destination: path.join(distFolder, 'Content/Fonts')
},
// Icon Images
{
from: 'frontend/src/Content/Images/Icons/*.*',
to: path.join(distFolder, 'Content/Images/Icons', '[name][ext]')
},
// Icon Images
{
source: 'frontend/src/Content/Images/Icons/*.*',
destination: path.join(distFolder, 'Content/Images/Icons')
},
// Images
{
from: 'frontend/src/Content/Images/*.*',
to: path.join(distFolder, 'Content/Images', '[name][ext]')
},
// Images
{
source: 'frontend/src/Content/Images/*.*',
destination: path.join(distFolder, 'Content/Images')
},
// Robots
{
from: 'frontend/src/Content/robots.txt',
to: path.join(distFolder, 'Content', '[name][ext]')
// Robots
{
source: 'frontend/src/Content/robots.txt',
destination: path.join(distFolder, 'Content/robots.txt')
}
]
}
]
}
}),
new LiveReloadPlugin()

View File

@ -99,7 +99,6 @@
"babel-loader": "8.2.2",
"babel-plugin-inline-classnames": "2.0.1",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"copy-webpack-plugin": "8.1.1",
"core-js": "3.11.0",
"css-loader": "5.2.4",
"eslint": "7.25.0",
@ -110,6 +109,7 @@
"eslint-plugin-simple-import-sort": "7.0.0",
"esprint": "2.0.0",
"file-loader": "6.2.0",
"filemanager-webpack-plugin": "5.0.0",
"html-webpack-plugin": "5.3.1",
"loader-utils": "^2.0.0",
"mini-css-extract-plugin": "1.5.0",

1463
yarn.lock

File diff suppressed because it is too large Load Diff