-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
95 lines (93 loc) · 2.46 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const path = require('path')
const VueLoaderPlugin = require('../vue-complier/vue-loader/lib/plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HelloWorldPlugin = require('./plugins/hello-world-plugin')
const FileListPlugin = require('./plugins/file-list-plugin')
const CheckCompilerHooksPlugin = require('./plugins/check-compiler-hooks-plugin')
const CheckCompilationHooksPlugin = require('./plugins/check-compilation-hooks-plugin')
const WebpackDispatchChunkPlugin = require('./plugins/webpack-dispatch-chunk-plugin')
function resolve (dir) {
return path.join(__dirname, dir)
}
module.exports = {
mode: 'development',
devtool: "eval-source-map", //
entry: __dirname + "/app/main.js",
output: {
path: __dirname + "/build",
filename: 'bundle-[hash].js'
},
devServer: {
contentBase: './public',
historyApiFallback: true,
inline: true
},
module: {
rules: [
{
test: /\.jsx/,
use: {
loader: path.resolve('./loaders/jsx-loader.js'),
options: {test: true}
}
},
{
test: /\.mp/,
use: {
loader: path.resolve('./loaders/mp-loader.js'),
}
},
{
test: /\.vue$/,
use: [path.resolve('../vue-complier/vue-loader/lib/index.js')]
},
{
test: /\.js$/,
use: {
loader: 'babel-loader'
},
exclude: [/node_modules/, /loaders/],
include: [resolve('app'), resolve('test')],
},
{
test: /\.css$/,
use: [{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: './'
}
}, {
loader: 'css-loader',
options: {
modules: false
}
}]
}
]
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
title: "Webpack-sample-project",
template: resolve("app/index.html"),
}),
new CleanWebpackPlugin(['build/*.*'], {
root: __dirname,
dry: false,
verbose: true
}),
new MiniCssExtractPlugin({
filename: '[name]-[hash].css',
chunkFilename: '[id].css'
}),
// new WebpackDispatchChunkPlugin({
// bundle: 'vendors'
// })
// new CheckCompilerHooksPlugin(),
// new FileListPlugin(),
// new CheckCompilationHooksPlugin()
// new HelloWorldPlugin()
]
}