This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
webpack.production.config.js
61 lines (59 loc) · 1.73 KB
/
webpack.production.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
58
59
60
61
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const WriteFilePlugin = require('write-file-webpack-plugin');
const flow = require('./package.json').flow;
module.exports = function(env) {
const config = {
entry: "./src/index.tsx",
output: {
filename: flow.filenames.js,
path: path.resolve(__dirname, 'build')
},
devtool: 'inline-source-map',
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"]
},
mode: 'production',
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
use: [
{
loader: 'tslint-loader',
options: {
fix: true
}
}
]
},
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader"
},
{
test: /\.js$/,
enforce: "pre",
loader: "source-map-loader"
},
{
test:/\.css$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader"
]
}
]
},
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
plugins: [
new WriteFilePlugin(),
new MiniCssExtractPlugin({ filename: flow.filenames.css })
],
}
return config;
};