-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.build.js
36 lines (33 loc) · 955 Bytes
/
webpack.build.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
const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = (env) => {
return {
entry: {
'led-matrix': path.resolve(__dirname, './dist/esm/index.js'),
'led-matrix.min': path.resolve(__dirname, './dist/esm/index.js'),
},
output: {
path: path.resolve(__dirname, './dist/umd'), // builds to ./dist/umd/
filename: './src/[name].js', // index.js
library: 'ledMatrix', // aka window.myLibrary
libraryTarget: 'umd', // supports commonjs, amd and web browsers
globalObject: 'this'
},
module: {
rules: [
{ test: /\.t|js$/, use: 'babel-loader' }
]
},
optimization: {
minimize: false // Disable minimization for non-minified file
},
devtool: 'source-map',
plugins: [
new UglifyJSPlugin({
sourceMap: true,
include: /\.min\.js$/
})
]
};
};