I'm trying to load and use a module I defined with Require. As far as I can tell, I'm following the patterns on the official site, but I'm not getting the loaded module inside the require call.
main.js:
define(function (require) {
require(['./util'], function(util){
util.dictionary();
});
...
});
util.js:
define(function(){
"use strict";
var util = {};
...
return util;
});
With this, util.dictionary() fails because util is undefined.
Both files are on the same directory level, and I haven't defined any baseURL for Require.
Why is this failing?
After a lot of poking around, I discovered that Chrome was using a cached versions of some of my files, and clearing the cache caused the modules to load correctly.
Yes, I'm a web development noob.
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.