forked from code4romania/war-support-dopomoha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
88 lines (74 loc) · 2.62 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const mix = require('laravel-mix');
const path = require('path');
const tailwindcss = require('tailwindcss');
require('laravel-mix-valet');
require('laravel-mix-bundle-analyzer');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel applications. By default, we are compiling the CSS
| file for the application as well as bundling up all the JS files.
|
*/
if (mix.inProduction()) {
mix.version();
}
if (mix.isWatching()) {
mix.bundleAnalyzer({ openAnalyzer: false });
}
mix.valet()
.alias({
'@': path.resolve('resources/js'),
'~': path.resolve('resources'),
})
.js('resources/js/public.js', 'public/assets')
.js('resources/js/admin.js', 'public/assets')
.vue({ version: 3 })
.postCss('resources/css/admin.css', 'public/assets/admin.css', [
tailwindcss('resources/themes/admin.tailwind.config.js'),
require('postcss-100vh-fix'),
])
.postCss('resources/css/public.css', 'public/assets/public.css', [
tailwindcss('resources/themes/public.tailwind.config.js'),
require('postcss-100vh-fix'),
])
.copyDirectory('resources/images', 'public/assets/images')
.sourceMaps(false)
.override((config) => {
const imageRule = config.module.rules.find((rule) =>
rule.test.test('.svg')
);
imageRule.test = /\.(png|jpe?g|gif|webp)$/;
const fontRule = config.module.rules.find((rule) =>
rule.test.test('font.*.svg')
);
fontRule.test = /\.(woff2?|ttf|eot|otf)$/;
config.module.rules.push({
test: /\.svg$/,
use: [
'raw-loader',
{
loader: 'vue-svg-loader',
options: {
svgo: {
plugins: [
{ removeDimensions: true },
{ removeViewBox: false },
{ removeXMLNS: true },
{
removeUselessStrokeAndFill: {
fill: true,
stroke: true,
removeNone: true,
},
},
],
},
},
},
],
});
});