-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
53 lines (51 loc) · 1.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
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
inject: 'body'
});
const SOURCE = /src/;
module.exports = {
entry: './src/index.tsx',
output: {
filename: 'bundle.js',
path: __dirname + '/dist'
},
devtool: 'source-map',
resolve: {
extensions: ['.tsx', '.ts', '.js', '.json']
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loaders: 'source-map-loader',
include: [SOURCE]
},
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
include: [SOURCE]
},
{ test: /\.js$/, loader: 'babel-loader', include: [SOURCE] },
{ test: /\.jsx$/, loader: 'babel-loader', include: [SOURCE] },
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader!postcss-loader!sass-loader'
})
}
]
},
plugins: [
HtmlWebpackPluginConfig,
new ExtractTextPlugin({
filename: '[name].css',
allChunks: true
})
]
};