-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
95 lines (92 loc) · 2.56 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 webpack = require('webpack');
const path = require('path');
const entries = {};
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
require('glob').sync('./resources/assets/js/*.js').map(entry => {
const name = entry.match('^.+/(.+?)\\.js$')[1];
entries[name] = entry;
});
module.exports = {
entry: entries,
output: {
path: path.join(__dirname, '/public'),
filename: './assets/[name].[hash].js',
hashDigestLength: 8,
},
resolve: {
alias: {
vue: 'vue/dist/vue.esm.js',
},
extensions: [ '.js', '.vue' ],
},
module: {
rules: [
{
test: /\.js$/,
use: [ 'babel-loader' ],
exclude: /node_modules/,
},
{
test: /\.vue$/,
use: [ 'vue-loader' ],
},
{
test: /\.(js|vue)$/,
use: [ 'eslint-loader' ],
exclude: /node_modules/,
enforce: 'pre',
},
{
test: /\.s?css$/,
use: [ 'style-loader', 'css-loader', 'postcss-loader', 'sass-loader' ],
},
{
test: /\.(woff2?|ttf|eot|svg|png)(\?v=[\d.]+|\?[\s\S]+)?$/,
use: [ 'file-loader?name=/assets/[name].[ext]' ],
},
],
},
optimization: {
runtimeChunk: {
name: 'vendor',
},
splitChunks: {
name: 'vendor',
chunks: 'initial',
},
},
performance: {
maxEntrypointSize: 1024000,
maxAssetSize: 1024000,
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
}),
new webpack.ProgressPlugin(percentage => {
if (percentage == 1) {
require('child_process').exec('./artisan view:clear');
}
}),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [
'assets/*.{ttf,eot,woff*,js,css,jp*g,png,gif}',
],
verbose: true,
}),
new (require('browser-sync-webpack-plugin'))({
proxy: process.env.PROXY_HOST || 'localhost',
files: './public/assets/*',
ghostMode: {
clicks: false,
scroll: false,
location: false,
forms: false,
},
open: false,
notify: false,
}),
new (require('vue-loader/lib/plugin'))(),
],
};