-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.dev.js
50 lines (48 loc) · 1.21 KB
/
webpack.dev.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
const path = require('path');
const Dotenv = require('dotenv-webpack');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin
const srcDir = path.resolve(__dirname, "src");
const distDir = path.resolve(__dirname, "dist/client");
module.exports = {
mode: "development",
watch: true,
devtool: "eval-source-map",
entry: {
app: path.resolve(srcDir, "index.tsx"),
},
output: {
path: distDir,
filename: "bundle.js",
publicPath: '/',
},
plugins: [
new HtmlWebPackPlugin({
template: path.resolve(srcDir, "index.html"),
inject: "body",
}),
new Dotenv(),
//UNCOMMENT TO RUN BUILD ANALIZER ON NPM RUN DEV
// new BundleAnalyzerPlugin()
],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: "ts-loader",
},
},
],
},
resolve: {
extensions: [".js", ".ts", ".tsx"],
fallback: {
"fs": require.resolve("browserify-fs"),
"stream": require.resolve("stream-browserify"),
"path": require.resolve("path-browserify"),
}
},
};