leanwebclub/structure-and-scale/seven-seas-service-worker
2024-09-09 17:55:31 +02:00
..
node_modules Add service worker first project 2024-09-05 10:59:07 +02:00
src Add service worker first project 2024-09-05 10:59:07 +02:00
bundle.js Add service worker first project 2024-09-05 10:59:07 +02:00
dice.html Add service worker projects 2024-09-09 17:55:31 +02:00
dice.js Add service worker first project 2024-09-05 10:59:07 +02:00
index.html Add service worker projects 2024-09-09 17:55:31 +02:00
index.html~ Add service worker first project 2024-09-05 10:59:07 +02:00
index.js Add service worker first project 2024-09-05 10:59:07 +02:00
offline.html Add service worker projects 2024-09-09 17:55:31 +02:00
package-lock.json Add service worker first project 2024-09-05 10:59:07 +02:00
package.json Add service worker first project 2024-09-05 10:59:07 +02:00
README.md Add service worker first project 2024-09-05 10:59:07 +02:00
rollup.config.js Add service worker first project 2024-09-05 10:59:07 +02:00
rollup.config.js~ Add service worker first project 2024-09-05 10:59:07 +02:00
style.css Add service worker first project 2024-09-05 10:59:07 +02:00
sw.js Add service worker projects 2024-09-09 17:55:31 +02:00
sw.js~ Add service worker first project 2024-09-05 10:59:07 +02:00
treasure.html Add service worker projects 2024-09-09 17:55:31 +02:00
treasure.js Add service worker first project 2024-09-05 10:59:07 +02:00

Project: Seven Seas - Bundle

Using rollup.js, bundle the modularized JavaScript files into an IIFE that can be run in the browser without the performance issues associated with the native ES modules.

Installing and Using Rollup

To install rollup globally:

npm install --global rollup

To run rollup:

rollup index.js --file bundle.js --format iife

To configure package.json and install rollup locally:

npm install rollup --save-dev

Update your package.json:

{
  "type": "module",
  "devDependencies": {
    "rollup": "^4.21.2"
  },
  "scripts": {
    "js": "rollup --config"
  }
}

Run the script:

npm run js