/
webpack.config.js
48 lines (46 loc) · 1.09 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
// @flow
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const extractLess = new ExtractTextPlugin({
filename: '[name].css',
});
module.exports = {
entry: './src/index.tsx',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".webpack.js", ".web.js", ".js", ".json"],
},
plugins: [
extractLess,
new HtmlWebpackPlugin({
title: 'Chip Tool',
hash: true,
template: 'src/index.ejs',
}),
],
module: {
rules: [
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" },
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" },
{
test: /\.less$/,
use: extractLess.extract({
use: [
{ loader: 'css-loader' },
{ loader: 'less-loader' },
],
fallback: 'style-loader',
}),
},
],
},
externals: {
"react": "React",
"react-dom": "ReactDOM",
},
};