-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
50 lines (42 loc) · 1.05 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
42
43
44
45
46
47
48
49
50
/**
* Copyright (c) 2018-2023 Nathan Curtis
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const path = require('path')
const webpack = require('webpack')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const prod = process.env.NODE_ENV === 'production'
const mode = prod ? 'production' : 'development'
module.exports = {
mode,
entry: './src/js/index.js',
module: {
rules: [{ test: /.js$/, exclude: /node_modules/, use: 'babel-loader' }]
},
resolve: {
extensions: ['.js']
},
plugins: [
new CleanWebpackPlugin(['dist']),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: `"${process.env.NODE_ENV || 'development'}"`
}
})
],
externals: {
'styled-components': {
commonjs: 'styled-components',
commonjs2: 'styled-components',
amd: 'styled-components'
}
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'heap.js',
library: 'heap',
libraryTarget: 'umd'
}
}