-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.common.js
executable file
·91 lines (89 loc) · 2.27 KB
/
webpack.common.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const path = require('path');
var webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const SRC_URL = "./src";
const DEST_URL = "./build/dist/";
module.exports = {
entry: {
app: ["whatwg-fetch", "babel-polyfill", SRC_URL + '/index']
},
optimization: {
splitChunks: {
chunks: 'all'
}
},
output: {
path: path.resolve(DEST_URL),
publicPath: '/dist'
},
plugins: [
new webpack.DefinePlugin({
COGNITO_USER_POOL_ID: `"${process.env.COGNITO_USER_POOL_ID}"`,
COGNITO_CLIENT_ID: `"${process.env.COGNITO_CLIENT_ID}"`,
ENDPOINT_URL: `"${process.env.ENDPOINT_URL}"`,
COGNITO_ENDPOINT_URL: `"${process.env.COGNITO_ENDPOINT_URL}"`,
LOGIN_REDIRECT_DEFAULT_SITE: `"${process.env.LOGIN_REDIRECT_DEFAULT_SITE}"`,
LOGIN_REDIRECT_WHITELIST: `"${process.env.LOGIN_REDIRECT_WHITELIST}"`,
GA_TRACKING_ID: `"${process.env.GA_TRACKING_ID}"`,
MODE: `"${process.env.MODE}"`,
HELP_URL: `"${process.env.HELP_URL}"`
}),
new HtmlWebpackPlugin({
title: 'TreeHacks Client',
template: './src/index.html',
filename: `./index.html`
})
],
module: {
rules: [
{
test: [/\.tsx?$/],
exclude: [/node_modules/, /\.test.tsx?$/],
use:
[
{
'loader': 'babel-loader',
options: {
"cacheDirectory": true,
"presets": [
["env", {
"targets": {
"browsers": [
"IE 8"
]
}
}]
]
}
},
{
'loader': 'ts-loader'
}
]
},
{
test: /\.s?css$/,
use: ['style-loader', 'css-loader', 'sass-loader'] //['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.(svg|png|jpg|woff|eot|ttf|otf|ico)$/,
use: [
{
loader: 'file-loader',
options: {
publicPath: "/dist"
}
}
]
}
]
},
resolve: {
modules: ['node_modules', 'scripts'],
extensions: ['.ts', '.tsx', '.js']
},
node: {
fs: "empty"
},
mode: 'development'
};