-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.prod.config.js
49 lines (48 loc) · 1.11 KB
/
webpack.prod.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
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
devtool: 'source-map',
entry: {
all: ['@babel/polyfill', __dirname + '/src/demo/js/index.ts'],
},
output: {
path: __dirname + '/docs/demo',
filename: '[name].js',
publicPath: '',
},
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{loader: 'css-loader', options: {sourceMap: true}},
],
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.js$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
},
],
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: '[name].css',
chunkFilename: '[id].css',
}),
new HtmlWebpackPlugin({
template: __dirname + '/src/demo/html/index.html',
}),
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
}