Created
February 15, 2021 17:04
-
-
Save yellow1912/c091cec5e35f6fefa56031aadf2c2758 to your computer and use it in GitHub Desktop.
webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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