добавляет rollup-plugin-workbox
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
41ff17345e
commit
4b8e488517
39
package-lock.json
generated
39
package-lock.json
generated
@ -8148,6 +8148,45 @@
|
||||
"terser": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"rollup-plugin-workbox": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-workbox/-/rollup-plugin-workbox-6.2.0.tgz",
|
||||
"integrity": "sha512-7v4X2uA88AGR69syAEMTrIW4+TQUid74zuQkFgTyCs8iuzBO6Dd9fB/P6eswmwd3J1F994c6eMHn7/hg3ZOvdw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@rollup/plugin-node-resolve": "^11.0.1",
|
||||
"@rollup/plugin-replace": "^3.0.0",
|
||||
"pretty-bytes": "^5.5.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"workbox-build": "^6.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rollup/plugin-node-resolve": {
|
||||
"version": "11.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz",
|
||||
"integrity": "sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@rollup/pluginutils": "^3.1.0",
|
||||
"@types/resolve": "1.17.1",
|
||||
"builtin-modules": "^3.1.0",
|
||||
"deepmerge": "^4.2.2",
|
||||
"is-module": "^1.0.0",
|
||||
"resolve": "^1.19.0"
|
||||
}
|
||||
},
|
||||
"@rollup/plugin-replace": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-3.1.0.tgz",
|
||||
"integrity": "sha512-pA3XRUrSKybVYqmH5TqWNZpGxF+VV+1GrYchKgCNIj2vsSOX7CVm2RCtx8p2nrC7xvkziYyK+lSi74T93MU3YA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@rollup/pluginutils": "^3.1.0",
|
||||
"magic-string": "^0.25.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"run-async": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
|
||||
|
@ -4,7 +4,7 @@
|
||||
"prestart": "node ./scripts/symlink.js",
|
||||
"start": "npx @11t/eleventy --serve",
|
||||
"prebuild": "node ./scripts/symlink.js",
|
||||
"build": "cross-env NODE_ENV=production npx @11t/eleventy && npm run build:sw",
|
||||
"build": "cross-env NODE_ENV=production npx @11t/eleventy",
|
||||
"build:sw": "workbox generateSW workbox-config.js",
|
||||
"stylelint": "stylelint 'src/**/*.css'",
|
||||
"eslint": "eslint src"
|
||||
@ -31,6 +31,7 @@
|
||||
"prismjs": "^1.28.0",
|
||||
"rollup": "^2.72.1",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-workbox": "^6.2.0",
|
||||
"simple-git-hooks": "^2.7.0",
|
||||
"stylelint": "^14.8.2",
|
||||
"stylelint-config-standard": "^25.0.0",
|
||||
|
@ -1,5 +1,8 @@
|
||||
import resolve from '@rollup/plugin-node-resolve'
|
||||
import { terser } from 'rollup-plugin-terser'
|
||||
import { injectManifest } from 'rollup-plugin-workbox'
|
||||
|
||||
const workboxConfig = require('./workbox-config')
|
||||
|
||||
export default {
|
||||
input: 'src/js/index.js',
|
||||
@ -7,5 +10,9 @@ export default {
|
||||
file: 'dist/js/bundle.js',
|
||||
format: 'esm'
|
||||
},
|
||||
plugins: [resolve(), terser()]
|
||||
plugins: [
|
||||
injectManifest(workboxConfig),
|
||||
resolve(),
|
||||
terser()
|
||||
]
|
||||
}
|
||||
|
4
src/js/sw.js
Normal file
4
src/js/sw.js
Normal file
@ -0,0 +1,4 @@
|
||||
import { precacheAndRoute } from 'workbox-precaching'
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
precacheAndRoute(self.__WB_MANIFEST)
|
@ -1,11 +1,10 @@
|
||||
module.exports = {
|
||||
globDirectory: 'dist/',
|
||||
globPatterns: [
|
||||
'**/*.{png,css,ico,svg,ttf,woff,woff2,js,json}'
|
||||
'**/*.{png,css,ico,svg,ttf,woff,woff2,js,json}',
|
||||
'index.html'
|
||||
],
|
||||
swSrc: 'src/js/sw.js',
|
||||
swDest: 'dist/sw.js',
|
||||
ignoreURLParametersMatching: [
|
||||
/^utm_/,
|
||||
/^fbclid$/
|
||||
]
|
||||
mode: 'production'
|
||||
}
|
||||
|
Reference in New Issue
Block a user