Open titanve opened 6 years ago
Hello @titanve!
entry: "./pass/to/your/sw/on/project/befor/compilation"
- it is where webpack will try to find your file. in Your case it should be entry: path.join(__dirname, 'sw_cached_pages.js')
(don't forget to const path = require('path')
)
filename: 'name-of-the-file-after-webpack-compilation'
- after webpack compilation it create file wit name you presented here.
You can check my answer on stack overflow for mor explanation on how to register sw.js correctly. :)
Hello everyone!
Can you please help me telling me what is the difference between
entry: " ..."
andfilename: " ..."
?I've been trying since yesterday to config the plugin but it's been impossible.
My
sw_cached_pages.js
is in the same folder of theindex.js
and webpack puts the bundles inside/dist
folderWhat is the right config in order to load my service worker file and get the
serviceWorkerOption
variable?My folder structure is: +- /spa --> |- /dist --> --> |- 1.bundle.js --> --> |- bundle.js --> --> |- sw.js <--- 'Generated by the plugin with the bundles list' --> |- index.js --> |- webpack.config.js --> |- sw_cached_pages.js
My plugin config:
Thank you in advance!