-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
54 lines (47 loc) · 1.43 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
var webpack = require('webpack')
var path = require('path')
module.exports = {
context: __dirname,
entry: [
'webpack-dev-server/client?http://0.0.0.0:8080',
'webpack/hot/only-dev-server',
__dirname + '/app/index.tsx'
],
output: {
filename: 'index.js',
path: __dirname + '/build',
publicPath: '/'
},
// Enable sourcemaps for debugging webpack's output.
devtool: 'inline-source-map',
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
module: {
loaders: [
{ test: /\.html$/, loader: 'file?name=[name].[ext]' },
// Was matching ts/tsx twice, can into implicit any errors
// http://stackoverflow.com/questions/33969292/how-do-i-get-this-typescript-webpack-project-to-compile-without-error
{ test: /\.tsx?$/, loader: 'ts-loader' },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.scss$/, loader: ['style', 'css', 'sass'] },
{ test: /\.(jpg|jpeg|png|woff|woff2|eot|ttf|svg)$/, loader: 'file-loader' }
],
preLoaders: [
{ test: /\.js$/, loader: 'source-map-loader' }
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.HotModuleReplacementPlugin()
]
}