-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.mix.js
74 lines (67 loc) · 1.72 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 path = require('node:path');
const realpath = (dest) => path.normalize(path.join(__dirname, dest));
const env = (process.env.NODE_ENV);
const mix = require('laravel-mix');
console.debug(env);
mix.disableNotifications();
mix.options({
publicPath: './assets/dist',
resourceRoot: './',
assetModules: true,
processCssUrls: true,
legacyNodePolyfills: false,
assetDirs: {
fonts: 'fonts',
images: 'images',
},
})
mix.webpackConfig({
cache: false,
stats: {
children: true,
},
module: {
rules: [
{
test: /\.js$/,
include: /node_modules/,
type: 'javascript/auto',
resolve: {
fullySpecified: false
}
},
]
},
resolve: {
fullySpecified: false,
extensions: ['.js', '.css', '.scss', '.sass'],
modules: [
realpath('node_modules'),
realpath('node_modules/mazer/src'),
realpath('assets/src'),
],
alias: {
// dont work, dont know //
'@': realpath('node_modules/mazer/src'),
'@/assets': realpath('node_modules/mazer/src/assets'),
}
}
})
mix
.copyDirectory('assets/src/images', 'assets/dist/images')
.copyDirectory('./node_modules/mazer/src/assets/static/images/logo', 'assets/dist/images/logo')
.copyDirectory('./node_modules/mazer/src/assets/static/images/svg-loaders', 'assets/dist/images/svg-loaders')
.sass('assets/src/app.scss', ".")
.sass('assets/src/app-dark.scss', ".")
.sass('./node_modules/mazer/src/assets/scss/pages/auth.scss', ".")
.js('assets/src/app.js', ".")
.js("./node_modules/mazer/src/assets/static/js/pages/horizontal-layout.js", ".")
if (env === 'production') {
mix.minify([
'assets/dist/app.css',
'assets/dist/app-dark.css',
'assets/dist/auth.css',
'assets/dist/assets/dist/app.js',
'assets/dist/assets/dist/horizontal-layout.js',
]);
}