I installed fancybox via NPM these ways:
npm i -D @fancyapps/ui
npm i -D @fancyapps/fancybox
and I now see fancybox in my devDependencies of my package.json:
"devDependencies": {
"@fancyapps/fancybox": "^3.5.7",
"@fancyapps/ui": "^4.0.31",
"jquery": "^3.6.0",....
},
however when I have this in my.js file:
console.log(Fancybox);
the console says:
Uncaught ReferenceError: Fancybox is not defined
How can I correctly install fancybox via NPM?
Installing with NPM CLI does not mean it magically know what you are using, you still need to import it. https://javascript.plainenglish.io/how-to-use-npm-and-import-export-modules-in-javascript-31a7f66a2064
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.