-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
54 lines (53 loc) · 1.49 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
/* eslint @typescript-eslint/no-var-requires: "off" */
const path = require("path")
const webpack = require("webpack")
const CopyWebpackPlugin = require("copy-webpack-plugin")
module.exports = {
devServer: {
historyApiFallback: true,
port: 3000,
proxy: {
"/graphql": {
target: "http://localhost:3080/graphql",
},
},
},
devtool: "source-map",
entry: "./src/index.tsx",
mode: process.env.MODE,
module: {
rules: [
{
exclude: /node_modules/,
test: /\.ts(x?)$/,
use: ["babel-loader"],
},
],
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "dist"),
publicPath: "/",
sourceMapFilename: "[name].js.map",
},
plugins: [
new webpack.EnvironmentPlugin({ MODE: process.env.MODE }),
new webpack.ProvidePlugin({ React: "react" }),
new webpack.SourceMapDevToolPlugin({ filename: "[file].map[query]" }),
new CopyWebpackPlugin({
patterns: [{ from: "./public", to: "./" }],
}),
],
resolve: {
alias: {
"#api": path.resolve(process.cwd(), "src/api"),
"#components": path.resolve(process.cwd(), "src/components"),
"#models": path.resolve(process.cwd(), "src/models"),
"#src": path.resolve(process.cwd(), "src"),
"#styles": path.resolve(process.cwd(), "src/styles"),
"#utils": path.resolve(process.cwd(), "src/utils"),
"#views": path.resolve(process.cwd(), "src/views"),
},
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
}