forked from otakustay/react-diff-view
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.demo.config.js
74 lines (72 loc) · 1.87 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @file 基础webpack配置
* @author zhanglili
*/
const path = require('path');
const {LoaderOptionsPlugin} = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'source-map',
context: __dirname,
entry: {
index: './demo/index.js'
},
output: {
path: path.join(__dirname, 'demo', 'dist'),
filename: 'index.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
]
},
{
test: require.resolve('./demo/parse'),
use: ['worker-loader']
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.svg$/,
use: ['svg-react-loader']
},
{
test: /\.(diff|raw)$/,
use: ['raw-loader']
}
]
},
resolve: {
extensions: ['.js'],
modules: ['node_modules']
},
plugins: [
new LoaderOptionsPlugin({minimize: false}),
new HtmlWebpackPlugin({title: 'react-diff-view'}),
new CaseSensitivePathsPlugin(),
new CopyWebpackPlugin([{from: 'demo/assets', to: 'assets'}])
],
devServer: {
// host: '0.0.0.0',
port: 9030,
open: true,
inline: true,
hot: false
}
};