-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.mix.js
61 lines (59 loc) · 2.64 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
const mix = require('laravel-mix');
const mixSsr = require('laravel-mix');
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
const SWPrecacheWebpackPlugin = require('sw-precache-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.
|
*/
mix.js('resources/backoffice/app.js', 'public/backoffice')
.js('resources/pos/app.js', 'public/pos')
.js('resources/receipt/app-client.js', 'public/receipt')
.js('resources/receipt/app-server.js', 'public/receipt')
.copy('node_modules/fingerprintjs2/dist/fingerprint2.min.js', 'public/js')
.sass('resources/styles/app.sass', 'public/css')
.webpackConfig({
resolve: {
extensions: ['.js', '.json', '.vue'],
alias: {
'~~': path.join(__dirname, './resources/backoffice'),
'~': path.join(__dirname, './resources/pos'),
'$pos': path.join(__dirname, './resources/pos/components'),
'$backoffice': path.join(__dirname, './resources/backoffice/components'),
'~~~': path.join(__dirname, './resources/receipt'),
'$receipt': path.join(__dirname, './resources/receipt'),
}
},
plugins: [
new VuetifyLoaderPlugin(),
new SWPrecacheWebpackPlugin({
cacheId: 'pwa',
filename: 'service-worker.js',
staticFileGlobs: ['public/**/*.{css,eot,svg,ttf,woff,woff2,js,html}'],
minify: true,
stripPrefix: 'public/pos',
handleFetch: true,
dynamicUrlToDependencies: {
'/': ['resources/views/pos.blade.php'],
},
staticFileGlobsIgnorePatterns: [/\.map$/, /mix-manifest\.json$/, /manifest\.json$/, /service-worker\.js$/],
navigateFallback: 'https://app.juztpoint.com/',
runtimeCaching: [{
urlPattern: /^https:\/\/fonts\.googleapis\.com\//,
handler: 'cacheFirst'
},
{
urlPattern: /^https:\/\/www\.thecocktaildb\.com\/images\/media\/drink\/(\w+)\.jpg/,
handler: 'cacheFirst'
}
],
})
]
})
.browserSync(process.env.PWA_APP_URL)