forked from indransyah/hacktoberfest-finder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
executable file
·84 lines (81 loc) · 2.26 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
const mix = require("laravel-mix");
const tailwindcss = require("tailwindcss");
const postCSSNested = require("postcss-nested");
const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin");
require("laravel-mix-purgecss");
require("laravel-mix-postcss-config");
mix
.setPublicPath("public")
.js("src/js/app.js", "public/js")
.postCss("src/css/app.css", "public/css")
.options({
processCssUrls: false,
postCss: [tailwindcss]
})
.postCssConfig({
plugins: [postCSSNested()]
})
.purgeCss({
enabled: mix.inProduction(),
globs: [path.join(__dirname, "public/index.html")],
extensions: ["html", "js"],
folders: ["src", "public"]
})
.webpackConfig({
plugins: [
new SWPrecacheWebpackPlugin({
cacheId: "hacktoberfest",
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: "service-worker.js",
navigateFallback: "/index.html",
staticFileGlobs: [
"public/css/**.*",
"public/favicons/**.*",
"public/images/**.*",
"public/js/**.*",
"public/index.html"
],
mergeStaticsConfig: true,
minify: mix.inProduction(),
stripPrefix: "public/",
handleFetch: true,
dynamicUrlToDependencies: {
"/": ["public/index.html"]
},
staticFileGlobsIgnorePatterns: [
/\.map$/,
/mix\-manifest\.json$/,
/manifest\.json$/,
/browserconfig\.xml$/,
/service\-worker\.js$/,
/robots\.txt$/
],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.(googleapis|gstatic)\.com\/css/,
handler: "cacheFirst"
},
{
urlPattern: /^https:\/\/([a-z0-9]+)\.cloudfront\.net\//,
handler: "cacheFirst"
},
{
urlPattern: /^https:\/\/api\.github\.com\/search\/issues/,
handler: "networkFirst"
},
{
urlPattern: /\/(images|favicons)\/(\w+)\.(png|jpg|gif|jpeg|jpe|bmp|svg|ico)$/,
handler: "cacheFirst"
}
]
})
]
})
.extract(["vue"]);
if (mix.inProduction()) {
mix.version().disableNotifications();
} else {
mix.sourceMaps().webpackConfig({
devtool: "inline-source-map"
});
}