-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathwebpack.demo.config.js
57 lines (56 loc) · 1.38 KB
/
webpack.demo.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
var path = require('path')
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
devServer: {
contentBase: path.join(__dirname, 'docs'),
port: 8080
},
entry: [
'./docs/index.tsx'
],
output: {
path: path.resolve('./docs/'),
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
alias: {
'react-month-picker-input/dist/react-month-picker-input.css': path.resolve('./src/styles/index.scss'),
'react-month-picker-input': path.resolve('./src/MonthPickerInput.tsx')
}
},
module: {
loaders: [
{
test: /\.tsx?$/,
loader: 'ts-loader?' + JSON.stringify({
configFile: 'tsbuild.json'
}),
exclude: /node_modules/
},
{
test: /\.css$/i,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{ loader: 'css-loader', options: { minimize: true } }
]
})
}
]
},
node: { Buffer: false },
plugins: [
new ExtractTextPlugin('style.css', { allChunks: true }),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new HtmlWebpackPlugin({
hash: true,
template: 'docs/index.ejs',
inject: 'body'
})
]
}