update webpack-related
This commit is contained in:
parent
e44b3b5d22
commit
5309106b1d
19
package.json
19
package.json
@ -10,8 +10,8 @@
|
||||
"license": "GPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-serve",
|
||||
"build": "rimraf public/app && node scripts/build",
|
||||
"dev": "webpack-dev-server",
|
||||
"build": "rimraf public/app && webpack --mode=production",
|
||||
"lint": "eslint --ext=.js,.vue -f=beauty .",
|
||||
"test": "jest",
|
||||
"codecov": "codecov -F js",
|
||||
@ -77,8 +77,8 @@
|
||||
"vue-loader": "^15.6.3",
|
||||
"vue-template-compiler": "^2.6.6",
|
||||
"webpack": "^4.29.4",
|
||||
"webpack-bundle-analyzer": "^3.0.4",
|
||||
"webpack-serve": "^2.0.2",
|
||||
"webpack-cli": "^3.2.3",
|
||||
"webpack-dev-server": "^3.1.14",
|
||||
"webpackbar": "^3.1.5",
|
||||
"yaml-loader": "^0.5.0"
|
||||
},
|
||||
@ -112,16 +112,5 @@
|
||||
},
|
||||
"jest-junit": {
|
||||
"usePathForSuiteName": true
|
||||
},
|
||||
"serve": {
|
||||
"clipboard": false,
|
||||
"devMiddleware": {
|
||||
"headers": {
|
||||
"Access-Control-Allow-Origin": "*"
|
||||
},
|
||||
"host": "0.0.0.0",
|
||||
"logLevel": "warn",
|
||||
"publicPath": "/public/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
const webpack = require('webpack');
|
||||
const webpackConfig = require('../webpack.config');
|
||||
|
||||
process.env.NODE_ENV = webpackConfig.mode = 'production';
|
||||
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
if (err || stats.hasErrors()) {
|
||||
err && console.log(err);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
});
|
@ -1,10 +1,10 @@
|
||||
const webpack = require('webpack');
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
const WebpackBar = require('webpackbar');
|
||||
|
||||
const devMode = process.env.WEBPACK_SERVE;
|
||||
const devMode = !process.argv.includes('--mode=production');
|
||||
|
||||
/** @type {import('webpack').Configuration} */
|
||||
const config = {
|
||||
@ -121,24 +121,29 @@ const config = {
|
||||
'resources/assets/src/images/bg.jpg',
|
||||
'resources/assets/src/images/favicon.ico',
|
||||
]),
|
||||
new BundleAnalyzerPlugin({
|
||||
openAnalyzer: false,
|
||||
analyzerMode: devMode ? 'server' : 'static'
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: {
|
||||
jquery: 'jquery/dist/jquery.min.js',
|
||||
sweetalert2$: 'sweetalert2/dist/sweetalert2.min.js',
|
||||
},
|
||||
extensions: ['.js', '.vue', '.json']
|
||||
},
|
||||
devtool: devMode ? 'cheap-module-eval-source-map' : false,
|
||||
devServer: {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
host: '0.0.0.0',
|
||||
hot: true,
|
||||
publicPath: '/public/',
|
||||
stats: 'errors-only'
|
||||
},
|
||||
stats: 'errors-only'
|
||||
};
|
||||
|
||||
if (!devMode) {
|
||||
process.env.NODE_ENV = 'production';
|
||||
config.plugins.push(new WebpackBar());
|
||||
config.plugins.push(new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }));
|
||||
} else {
|
||||
config.plugins.push(new webpack.HotModuleReplacementPlugin());
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
Loading…
Reference in New Issue
Block a user