-
Notifications
You must be signed in to change notification settings - Fork 74
/
webpack.mix.js
90 lines (86 loc) · 3.07 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
89
const mix = require('laravel-mix');
const webpack = require('webpack');
const path = require('path');
const CircularDependencyPlugin = require('circular-dependency-plugin');
mix.js('resources/assets/js/sharp.js', 'resources/assets/dist/sharp.js').vue()
.js('resources/assets/js/client-api.js', 'resources/assets/dist/client-api.js')
.sass('resources/assets/sass/app.scss', 'sharp.css', { implementation:require('sass-embedded') })
.sass('resources/assets/sass/vendors.scss', 'vendors.css', { implementation:require('sass-embedded') })
.copy('node_modules/@fortawesome/fontawesome-free/webfonts/*', 'resources/assets/dist/fonts')
.copy('node_modules/leaflet/dist/images/*', 'resources/assets/dist/images')
.options({
processCssUrls: false,
terser: {
terserOptions: {
format: {
comments: false,
},
},
extractComments: false,
},
})
.extract()
.setResourceRoot('/vendor/sharp')
.setPublicPath('resources/assets/dist')
.webpackConfig({
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
],
// transpile vue-clip package
module: {
rules: [
{
test: /\.js$/,
include: [
path.resolve(__dirname, 'node_modules/vue-clip'),
path.resolve(__dirname, 'node_modules/vue2-timepicker')
],
use: [
{
loader: 'babel-loader',
options: (new require('laravel-mix/src/BabelConfig')).default(),
}
]
},
{
test: /bootstrap-vue\/esm\/(icons\/icons)/,
use: 'null-loader'
}
]
},
resolve: {
alias: {
// resolve [email protected] polyfills (now 3.0)
'core-js/fn': 'core-js/features',
'sharp/scss': path.resolve(__dirname, 'resources/assets/sass'),
},
}
});
if(mix.inProduction()) {
mix.version();
}
else {
mix.webpackConfig({
plugins: [
new CircularDependencyPlugin({
exclude: /node_modules/,
failOnError: true,
allowAsyncCycles: false,
cwd: process.cwd(),
}),
// new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
],
resolve: {
alias: {
// ...require('fs').existsSync('../packages/tiptap-markdown') && {
// 'tiptap-markdown': console.warn('\x1b[33m⚠️ Using local tiptap-markdown\n\n')
// || path.resolve(__dirname, '../packages/tiptap-markdown')
// },
},
modules: [path.resolve(__dirname, 'node_modules'), 'node_modules'],
}
});
}