improve webpack.config.js
This commit is contained in:
parent
6fcb656299
commit
0e033256f0
|
@ -11,11 +11,11 @@
|
||||||
"build:watch": "webpack --watch",
|
"build:watch": "webpack --watch",
|
||||||
"lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:ec",
|
"lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:ec",
|
||||||
"lint:eslint": "eslint .",
|
"lint:eslint": "eslint .",
|
||||||
"lint:prettier": "prettier --check resources/assets",
|
"lint:prettier": "prettier --check resources/assets webpack.config.js",
|
||||||
"lint:ec": "ec",
|
"lint:ec": "ec",
|
||||||
"lint:fix": "yarn lint:fix:eslint && yarn lint:fix:prettier",
|
"lint:fix": "yarn lint:fix:eslint && yarn lint:fix:prettier",
|
||||||
"lint:fix:eslint": "eslint --fix .",
|
"lint:fix:eslint": "eslint --fix .",
|
||||||
"lint:fix:prettier": "prettier --write resources/assets"
|
"lint:fix:prettier": "prettier --write resources/assets webpack.config.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@popperjs/core": "^2.11.6",
|
"@popperjs/core": "^2.11.6",
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
const nodeEnv = (process.env.NODE_ENV || 'development').trim();
|
|
||||||
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
|
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
|
||||||
const fs = require('fs');
|
|
||||||
|
const nodeEnv = (process.env.NODE_ENV || 'development').trim();
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const __DEV__ = nodeEnv !== 'production';
|
const __DEV__ = nodeEnv !== 'production';
|
||||||
|
|
||||||
const devtool = __DEV__ ? 'source-map' : undefined
|
const devtool = __DEV__ ? 'source-map' : undefined;
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
|
@ -45,7 +46,7 @@ module.exports = {
|
||||||
mode: __DEV__ ? 'development' : 'production',
|
mode: __DEV__ ? 'development' : 'production',
|
||||||
context: __dirname,
|
context: __dirname,
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.jsx'],
|
extensions: ['.js'],
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
...themeEntries,
|
...themeEntries,
|
||||||
|
@ -63,7 +64,7 @@ module.exports = {
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.jsx?$/,
|
test: /\.js$/,
|
||||||
exclude: /(node_modules)/,
|
exclude: /(node_modules)/,
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
},
|
},
|
||||||
|
@ -78,7 +79,7 @@ module.exports = {
|
||||||
loader: 'postcss-loader',
|
loader: 'postcss-loader',
|
||||||
options: {
|
options: {
|
||||||
postcssOptions: {
|
postcssOptions: {
|
||||||
plugins: [ [ 'autoprefixer', ], ],
|
plugins: [['autoprefixer']],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -90,12 +91,12 @@ module.exports = {
|
||||||
options: {
|
options: {
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
sassOptions: {
|
sassOptions: {
|
||||||
quietDeps: true
|
quietDeps: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins,
|
plugins,
|
||||||
|
|
Loading…
Reference in New Issue