leanwebclub/structure-and-scale/seven-seas-bundlers
2024-09-02 09:39:19 +02:00
..
node_modules Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
src Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
bundle.js Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
dice.html Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
index.html Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
index.js Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
package-lock.json Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
package.json Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
README.md Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
rollup.config.js Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
style.css Add projects with ES modules and bundling 2024-09-02 09:39:19 +02:00
treasure.html Add projects with ES modules and bundling 2024-09-02 09:39:19 +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