Skip to content

Instantly share code, notes, and snippets.

@yellow1912
Created February 15, 2021 17:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yellow1912/c091cec5e35f6fefa56031aadf2c2758 to your computer and use it in GitHub Desktop.
Save yellow1912/c091cec5e35f6fefa56031aadf2c2758 to your computer and use it in GitHub Desktop.
webpack.config.js
const path = require('path');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const webpack = require('webpack');
// const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
// const smp = new SpeedMeasurePlugin();
const WEPACK_CONFIG = {
entry: {
"main": path.resolve(__dirname, "src/js/main.js")
},
output: {
filename: '[name].min.js',
path: path.resolve(__dirname, 'public/js'),
sourceMapFilename: '[name].min.js.map',
libraryTarget: 'var'
},
stats: {
colors: true,
hash: false,
version: false,
timings: false,
assets: false,
chunks: false,
modules: false,
reasons: false,
children: false,
source: false,
errors: true,
errorDetails: true,
warnings: false,
publicPath: false
},
resolve: {
modules: [
path.join(__dirname, '/node_modules'),
path.join(__dirname, '/node_modules/.pnpm/node_modules')
],
alias: {
'vue$': 'vue/dist/vue.js'
},
extensions: ['.js']
},
optimization: {
runtimeChunk: {
name: "runtime"
},
splitChunks: {
chunks: 'all',
name: 'split'
}
},
plugins: [
new webpack['SourceMapDevToolPlugin']({
filename: '[name].min.js.map',
noSources: true
}),
new CleanWebpackPlugin({cleanStaleWebpackAssets: false}),
],
mode: 'production'
};
module.exports = WEPACK_CONFIG;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment