Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
73 lines (62 loc) · 1.53 KB
/
Copy pathwebpack.config.js
File metadata and controls
73 lines (62 loc) · 1.53 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* eslint-disable @typescript-eslint/no-var-requires */
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const ROOT = __dirname;
const PORT = 3000;
module.exports = {
cache: true,
devServer: {
contentBase: path.join(ROOT, 'dist'),
host: 'localhost',
inline: true,
lazy: false,
noInfo: false,
port: PORT,
quiet: false,
},
devtool: 'source-map',
entry: [path.resolve(ROOT, 'DEV_ONLY', 'index.tsx')],
mode: 'development',
module: {
rules: [
{
enforce: 'pre',
include: [path.resolve(ROOT, 'src')],
loader: 'eslint-loader',
options: {
configFile: '.eslintrc',
failOnError: true,
failOnWarning: false,
fix: true,
formatter: require('eslint-friendly-formatter'),
},
test: /\.(js|ts|tsx)$/,
},
{
include: [path.resolve(ROOT, 'src'), path.resolve(ROOT, 'DEV_ONLY')],
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: ['@babel/preset-react'],
},
test: /\.(js|ts|tsx)$/,
},
],
},
output: {
filename: 'moize.js',
library: 'moize',
libraryTarget: 'umd',
path: path.resolve(ROOT, 'dist'),
publicPath: `http://localhost:${PORT}/`,
umdNamedDefine: true,
},
plugins: [
new webpack.EnvironmentPlugin(['NODE_ENV']),
new HtmlWebpackPlugin(),
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
};