-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·66 lines (59 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
55
56
57
58
59
60
61
62
63
64
65
66
const webpack = require('webpack');
const path = require('path');
module.exports = {
// put sourcemaps inline
devtool: 'eval',
mode: "production",
// entry point of our application, within the `src` directory (which we add to resolve.modules below):
entry: ['index.tsx'],
// configure the output directory and publicPath for the devServer
output: {
filename: 'app.js',
publicPath: 'dist',
path: path.resolve('dist'),
},
// configure the dev server to run
devServer: {
port: 3000,
historyApiFallback: true,
inline: true,
},
// tell Webpack to load TypeScript files
resolve: {
// Look for modules in .ts(x) files first, then .js
extensions: ['.ts', '.tsx', '.js'],
// add 'src' to the modules, so that when you import files you can do so with 'src' as the relative route
modules: ['src', 'node_modules'],
},
module: {
rules: [{
test: /\.tsx?$/,
exclude: /node_modules/,
enforce: "pre",
use: [{
loader: 'babel-loader'
}, {
loader: 'ts-loader',
}, ]
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [{
loader: 'style-loader'
},
{
loader: "css-loader"
},
{
loader: "sass-loader",
}
]
}
]
},
externals: {
// "react": "React",
// "react-dom": "ReactDOM"
}
};