-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
41 lines (40 loc) · 1.15 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: "./src/index.ts",
output: {
filename: "index.min.js",
path: path.resolve(__dirname, 'dist'),
// library: 'jsUtilsHelper',
// libraryTarget: 'umd'
},
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
hot: true
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
plugins: [
new BundleAnalyzerPlugin(),
new CleanWebpackPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin()
],
optimization: {
// @see https://webpack.js.org/plugins/uglifyjs-webpack-plugin
minimizer: [new UglifyJsPlugin()],
},
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{ test: /\.tsx?$/, loader: "ts-loader" }
]
}
};