-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (42 loc) · 1 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
const webpack = require('webpack');
const dotenv = require('dotenv');
const env = dotenv.config().parsed;
// reduce all env keys to an object for DefinePlugin below
const envKeys = Object.keys(env).reduce((prev, next) => {
prev[`process.env.${next}`] = JSON.stringify(env[next]);
return prev;
}, {});
module.exports = {
devtool: 'inline-source-map',
entry: './src/index.tsx',
output: {
path: __dirname + '/public',
filename: 'build/app.js'
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.scss']
},
devServer: {
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
}
},
module: {
loaders: [
{ test: /\.tsx?$/, loader: 'ts-loader' },
{
test: /\.scss$/,
exclude: /node_modules/,
loader: [
"style-loader",
"css-loader",
"sass-loader"
]
}
]
},
plugins: [
new webpack.DefinePlugin(envKeys)
]
}