-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.dev.js
115 lines (114 loc) · 3.79 KB
/
webpack.dev.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: {
app: ['whatwg-fetch', 'react-hot-loader/patch', './src/app.tsx'],
vendor: [
'slate',
'slate-react',
'slate-html-serializer',
'slate-plain-serializer',
'history',
'immutable',
'json-beautify',
'jquery',
'keycloak-js',
'react',
'react-addons-css-transition-group',
'react-addons-shallow-compare',
'react-bootstrap-typeahead',
'react-dnd',
'react-dnd-html5-backend',
'react-dom',
'react-redux',
'redux',
'redux-thunk',
'tsmonad',
'whatwg-fetch'
]
},
output: {
filename: '[name].js'
},
externals: {
},
devtool: 'source-map',
devServer: {
contentBase: __dirname,
historyApiFallback: true,
hot: false,
disableHostCheck: true,
port: 9000,
host: '0.0.0.0',
stats: {
colors: true
},
proxy: {
'/webcontents': 'http://dev.local',
'/content-service': 'http://dev.local',
}
},
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: ['.ts', '.tsx', '.js', '.jss'],
// Add webpack aliases for top level imports
alias: {
actions: path.resolve(__dirname, 'src/actions'),
components: path.resolve(__dirname, 'src/components'),
data: path.resolve(__dirname, 'src/data'),
editors: path.resolve(__dirname, 'src/editors'),
reducers: path.resolve(__dirname, 'src/reducers'),
styles: path.resolve(__dirname, 'src/styles'),
stylesheets: path.resolve(__dirname, 'src/stylesheets'),
types: path.resolve(__dirname, 'src/types'),
utils: path.resolve(__dirname, 'src/utils'),
},
},
module: {
unknownContextCritical: false,
rules: [
{ test: /\.html$/, loader: 'underscore-template-loader' },
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{
test: /\.scss$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{
loader: 'sass-loader',
options: {
includePaths: [
path.join(__dirname, 'src/stylesheets'),
],
sourceMap: true
}
}]
},
{ test: /\.(png|gif|jpg|jpeg|svg)$/, use: 'file-loader' },
{ test: /\.ts$/, use: ['babel-loader', 'ts-loader'], exclude: /node_modules/ },
{
test: /\.tsx$/, use: [
{
loader: 'babel-loader',
options: {
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
plugins: []
},
},
{ loader: 'ts-loader' }
], exclude: /node_modules/
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: '!!underscore-template-loader!./index.html',
inject: false,
favicon: 'assets/oli-icon.png',
}),
]
};