improve webpack.config.js

This commit is contained in:
Thomas Rupprecht 2023-02-15 17:51:15 +01:00 committed by GitHub
parent 6fcb656299
commit 0e033256f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 13 deletions

View File

@ -11,11 +11,11 @@
"build:watch": "webpack --watch",
"lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:ec",
"lint:eslint": "eslint .",
"lint:prettier": "prettier --check resources/assets",
"lint:prettier": "prettier --check resources/assets webpack.config.js",
"lint:ec": "ec",
"lint:fix": "yarn lint:fix:eslint && yarn lint:fix:prettier",
"lint:fix:eslint": "eslint --fix .",
"lint:fix:prettier": "prettier --write resources/assets"
"lint:fix:prettier": "prettier --write resources/assets webpack.config.js"
},
"dependencies": {
"@popperjs/core": "^2.11.6",

View File

@ -1,16 +1,17 @@
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const nodeEnv = (process.env.NODE_ENV || 'development').trim();
const {WebpackManifestPlugin} = require('webpack-manifest-plugin');
const fs = require('fs');
// eslint-disable-next-line
const __DEV__ = nodeEnv !== 'production';
const devtool = __DEV__ ? 'source-map' : undefined
const devtool = __DEV__ ? 'source-map' : undefined;
const plugins = [
new webpack.DefinePlugin({
@ -45,7 +46,7 @@ module.exports = {
mode: __DEV__ ? 'development' : 'production',
context: __dirname,
resolve: {
extensions: ['.js', '.jsx'],
extensions: ['.js'],
},
entry: {
...themeEntries,
@ -63,7 +64,7 @@ module.exports = {
module: {
rules: [
{
test: /\.jsx?$/,
test: /\.js$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
},
@ -78,7 +79,7 @@ module.exports = {
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [ [ 'autoprefixer', ], ],
plugins: [['autoprefixer']],
},
},
},
@ -90,12 +91,12 @@ module.exports = {
options: {
sourceMap: true,
sassOptions: {
quietDeps: true
}
}
quietDeps: true,
},
},
},
],
},
]
}
],
},
plugins,