I'm trying to get the Parcel bundler to bundle my small static website that I'm building, so I can use npm packages etc. in my JS.
I've had several issues with it, but the sticking point seems to be using bootstrap, which only ever loads on one page.
I may be being incredibly dense here, but surely there must be a way to use NPM packages in your JS and bundle it up for live use.
Question: Why is bootstrap only loading on the contact.html page?
Sub-question: Is there a better alternative to packaging JS for use in static sites? (so I can use NPM packages)?
My file structure
My package.json file:
{
"name": "parcel-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "parcel index.html about.html contact.html",
"build": "parcel build index.html about.html contact.html"
},
"author": "",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.14.1",
"parcel-bundler": "^1.12.4"
},
"dependencies": {
"bootstrap": "^4.5.2",
"jquery": "^3.5.1",
"popper.js": "^1.16.1"
}
}
main.js
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.css';