This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
92 lines (80 loc) · 2.23 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
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
92
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const webpack = require("webpack");
const isDebug = process.env.NODE_ENV !== 'production';
const stats = {
colors: true,
children: false,
reasons: true,
timings: true,
chunks: false,
chunkModules: false,
cached: false,
cachedAssets: false,
};
module.exports = {
debug: isDebug,
devtool: 'source-map',
context: __dirname,
stats,
entry: [
'whatwg-fetch',
'./client/index.tsx',
],
output: {
filename: './dist/bundle.js',
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js', '.css'],
},
module: {
preLoaders: [
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{
test: /\.js$/,
loader: 'source-map',
},
],
loaders: [
{
test: /\.tsx?$/,
loaders: [
`babel?${JSON.stringify({
presets: [
"es2015",
"stage-0",
],
})}`,
'ts',
]
},
{
test: /\.json$/,
loader: 'json',
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', [
'css?sourceMap&-minimize&importLoaders=1',
'postcss',
]),
},
],
},
postcss: () => {
return [
require('stylelint'),
require('postcss-import'),
require('postcss-cssnext'),
require('postcss-reporter')({ clearMessages: true }),
];
},
plugins: [
new ExtractTextPlugin('./dist/styles.css'),
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
GOOGLE_ANALYTICS_ID: JSON.stringify('REDACTED'),
BUGSNAG_API_KEY: JSON.stringify('REDACTED'),
FACEBOOK_APP_ID: JSON.stringify(!isDebug ? 'REDACTED' : 'REDACTED'),
}),
],
};