forked from ExpDev07/legacy-rp-admin-v3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.mix.js
74 lines (62 loc) · 1.61 KB
/
webpack.mix.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
const mix = require('laravel-mix');
require('laravel-mix-clean');
require('./scripts/clean-emit.js');
const TerserPlugin = require('terser-webpack-plugin');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
// Disable notifications.
mix.disableNotifications();
// Version & source maps.
mix.version();
mix.sourceMaps(false);
// Assets.
mix.js('resources/js/app.js', 'public/js')
.vue();
mix.postCss('resources/css/app.pcss', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
]);
mix.copy('resources/css/all.min.css', 'public/css/all.min.css');
// Extract & cleanup.
mix.extract();
mix.clean({
protectWebpackAssets: false,
cleanOnceBeforeBuildPatterns: [
'css/*',
'js/*',
],
});
mix.cleanEmit({
remove: [
/\.LICENSE\.txt$/m,
],
stripComments: true,
});
// Config.
mix.webpackConfig({
output: {
chunkFilename: fileHash,
},
devtool: false,
optimization: {
minimize: mix.inProduction(),
minimizer: [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
extractComments: false,
}),
],
},
});
function fileHash(chunk) {
const hash = chunk.chunk.hash.slice(0, 8);
return `js/chunk.${hash}.js`;
}