-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.ts
46 lines (41 loc) · 1.15 KB
/
webpack.config.ts
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
/**
* Don't forget to run the DLL config for WebPack first for correct DLL references
*/
import { Configuration as WebpackConfig } from "webpack";
import devConfig from "./webpack/development";
import prodConfig from "./webpack/production";
const config = (_: any, args: WebpackConfig): WebpackConfig => {
/* eslint-disable-line */
/**
* The common WebPack configuration no matter what environment it is run on
*/
const commonConfig: WebpackConfig = {
entry: {
app: "./src/ts/index.tsx",
},
mode: args.mode,
module: {
rules: [
{
exclude: /node_modules/,
test: /\.tsx?$/,
loaders: ["babel-loader", "ts-loader"],
},
{
test: /\.(eot|svg|ttf|otf|woff|woff2)$/,
use: "file-loader?name=[name].[ext]",
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
};
const additionalConfig =
args.mode === "production" ? prodConfig(__dirname) : devConfig(__dirname);
/**
* Merge the common configuration with environment-specific ones
*/
return { ...commonConfig, ...additionalConfig };
};
export default config;