-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
42 lines (39 loc) · 1.1 KB
/
webpack.config.js
File metadata and controls
42 lines (39 loc) · 1.1 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
const path = require("path");
// Base config that applies to either development or production mode.
const config = {
entry: "./src/index.ts",
output: {
library: "@nitrobolt/shared",
libraryTarget: "commonjs2",
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
// Enable webpack-dev-server to get hot refresh of the app.
devServer: {
static: "./build",
},
};
module.exports = (env, argv) => {
if (argv.mode === "development") {
// Set the output path to the `build` directory
// so we don't clobber production builds.
config.output.path = path.resolve(__dirname, "build");
// Generate source maps for our code for easier debugging.
// Not suitable for production builds. If you want source maps in
// production, choose a different one from https://webpack.js.org/configuration/devtool
config.devtool = "eval-cheap-module-source-map";
}
return config;
};