-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (36 loc) · 1023 Bytes
/
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
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const PRODUCTION_ENV = 'production';
const DEVELOPMENT_ENV = 'development';
const { NODE_ENV = PRODUCTION_ENV } = process.env;
const isProduction = NODE_ENV === PRODUCTION_ENV;
const dirDist = path.resolve(__dirname);
const dirSrc = path.resolve(__dirname, 'src');
const libraryName = 'fishTacos';
const config = {
mode: isProduction ? PRODUCTION_ENV : DEVELOPMENT_ENV,
entry: dirSrc,
output: {
path: dirDist,
filename: 'index.js',
library: libraryName,
libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this",
},
devtool: isProduction ? 'source-map' : 'cheap-source-map',
stats: isProduction ? 'normal' : 'errors-only',
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
include: dirSrc,
},
],
},
resolve: {
extensions: ['.ts'],
},
// plugins: [new CleanWebpackPlugin(dirDist)]
};
module.exports = config;