famo.us bug on require LightBox
-
21-12-2019 - |
Question
I have a problem with famo.us when i make a simple require for LightBox.
var StateModifier = require('famous/modifiers/StateModifier');
var Lightbox = require('famous/views/LightBox');
var SlideView = require('views/SlideView');
I don't know why but console return this message:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8888/slideshow/start/src/famous/views/LightBox.js
My question is: why famo.us search on local directory instead search online?
Thanks, Andrea.
Solution
RequireJS doesn't search online for files. It's merely finding javascript files it's pointed to in requireConfig
.
RequireJS automatically assumes that each file is a JS file, so the .js
extensions are left out from the paths when you call require()
In this case, all you have is a typo. LightBox should be Lightbox - so rather than looking for LightBox.js
you should be looking for Lightbox.js
ie:
var Lightbox = require(`famous/views/Lightbox`);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow