-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
121 lines (116 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
const mix = require('laravel-mix');
require('laravel-mix-banner');
require('laravel-mix-bundle-analyzer');
require('laravel-mix-compress-images');
require('laravel-mix-definitions');
require('laravel-mix-dload');
require('laravel-mix-remove-flow-types');
require('laravel-mix-svg-vue');
require('laravel-mix-tailwind');
require('laravel-mix-vue-auto-routing');
require('laravel-mix-workbox');
let LiveReloadPlugin = require('webpack-livereload-plugin');
let tailwindcss = require('tailwindcss');
/*
|--------------------------------------------------------------------------
| 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.
|
*/
mix.removeFlowTypes()
.js('resources/js/app.js', 'public/js')
.svgVue()
.definition({
$: 'jQuery',
_: 'lodash'
})
.vueAutoRouting()
.extract(['jquery', 'vue'])
.compressImages(
['img\/**\/*'],
'destination',
{
jpg: {
engine: 'mozjpeg',
command: ['-quality', '20']
}
}
)
.download({
enabled: mix.inProduction(),
urls: [
{
'url': 'https://www.google-analytics.com/analytics.js',
'dest': './public/js/'
},
],
})
.sass('resources/sass/app.scss', 'public/css')
.options({
processCssUrls: false,
postCss: [tailwindcss('./tailwind.config.js')],
})
.generateSW()
.banner({
banner: (function () {
return [
'/**',
' * @project Datacenter Automation Suite',
' * @author A. Renner',
' * @release 0.0.1-alpha',
' *',
' */',
'',
].join('\n');
})(),
raw: true,
})
.version()
.copy('node_modules/font-awesome/fonts/*', 'public/fonts/')
.copy('node_modules/ionicons/dist/fonts/*', 'public/fonts/')
.copy('node_modules/material-design-iconic-font/dist/fonts/*', 'public/fonts/')
.copy('node_modules/simple-line-icons/fonts/*', 'public/fonts/')
.browserSync({
proxy: '199.38.247.22',
plugins: [
'bs-console-qrcode',
'bs-latency',
'bs-fullscreen-message',
'bs-console-info',
'bs-eslint-message']
})
.tailwind();
if (mix.isWatching()) {
mix.bundleAnalyzer();
}
mix.babelConfig({
plugins: ['@babel/plugin-syntax-dynamic-import'],
});
mix.webpackConfig({
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {appendTsSuffixTo: [/\.vue$/]},
exclude: /node_modules/,
},
],
},
plugins: [
new LiveReloadPlugin()
],
resolve: {
extensions: ['*', '.js', '.jsx', '.vue', '.ts', '.tsx'],
alias: {
'@components': path.resolve(__dirname, 'resources/js/Components/'),
'@models': path.resolve(__dirname, 'resources/js/models/'),
'@sections': path.resolve(__dirname, 'resources/js/sections/'),
'@services': path.resolve(__dirname, 'resources/js/services/'),
}
},
});