-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
57 lines (50 loc) · 1.43 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// TODO: resolve @ alias
// TODO: plugins
// TODO: Depending on mode: Last part in here https://webpack.js.org/concepts/mode/
const path = require("path")
const webpack = require("webpack")
const nodeExternals = require("webpack-node-externals")
module.exports = {
// https://github.com/liady/webpack-node-externals#quick-usage
target: "node",
externals: [nodeExternals()],
// Change this if you want to keep your code confidential
// See: https://blog.scottlogic.com/2017/11/01/webpack-source-map-options-quick-guide.html
devtool: "source-map",
entry: "./src/index.ts",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: "graphql-tag/loader",
},
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
extensions: [".tsx", ".ts", ".js"],
},
plugins: [
// HMR should never be used in production
new webpack.HotModuleReplacementPlugin(),
// https://github.com/lorenwest/node-config/wiki/Webpack-Usage
new webpack.DefinePlugin({ CONFIG: JSON.stringify(require("config")) }),
],
optimization: {
// namedModules: true, // Not set, since used in dev mode and not in pro
emitOnErrors: false,
},
}