-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathwebpack.config.js
40 lines (38 loc) · 1.01 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const webpack = require('webpack');
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
entry: './src/index.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: isProd ? 'ttag.min.js' : 'ttag.js',
libraryTarget: 'umd',
globalObject: 'this',
},
devtool: false,
module: {
rules: [
{
test: /\.(js|ts)$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.js', '.ts'],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
},
}),
],
};