Closed panteng closed 8 years ago
What I have is this
var $ = require('jquery');
import 'remodal'
@rdpascua Thx.
I found the reason. It was because my NPM is outdated.
Npm v.2.x.x installs nested dependencies. That means I have two jquery packages in my node_modules folder. One is for Remodal (node_modules/remodal/node_modules/jquery/), the other is for the whole app(node_modules/jquery).
So when I call var $ = require('jquery')
, actually I am not requiring the same jquery that Remodal requires. That's why the chrome console says Uncaught TypeError: $(...).remodal is not a function
I'm loading my jQuery from a CDN using the $script loader and then requiring remodal after the dependency, jquery and $
, have been defined.
$script("https://code.jquery.com/jquery-1.12.3.min.js", function() {
window.fcJq = jQuery.noConflict(true);
requirePackage("jquery");
var remodal = require('remodal');
});
@andrebautista Thank you. This problem has been solved.
Below is my code. I use Webpack to bundle them.
But there's something wrong. The console says:
Could anyone help me? Thanks.