Cannot use with r.js compiler of requirejs AMD system
See original GitHub issueHi there!
I cant compile in one file my amd modules (with you dependencies) because here https://github.com/amplitude/Amplitude-Javascript/blob/master/amplitude.js#L5 writen this code
return require('1')
can you change it on correct AMD wrapper Smth like this
(function (root, factory) {
if(typeof define === "function" && define.amd) {
// Now we're wrapping the factory and assigning the return
// value to the root (window) and returning it as well to
// the AMD loader.
define(["postal"], function(postal){
return (root.myModule = factory(postal));
});
} else if(typeof module === "object" && module.exports) {
// I've not encountered a need for this yet, since I haven't
// run into a scenario where plain modules depend on CommonJS
// *and* I happen to be loading in a CJS browser environment
// but I'm including it for the sake of being thorough
module.exports = (root.myModule = factory(require("postal")));
} else {
root.myModule = factory(root.postal);
}
}(this, function(postal) {
// module code here....
return myModule;
}));
Thank you!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
javascript - r.js won't compile ES6 - Stack Overflow
I tried webpack, but it seems i can't get it work. I need the same output as r.js with unnamed defines to concatenated...
Read more >RequireJS Optimizer
Combines related scripts together into build layers and minifies them via UglifyJS (the default) or Closure Compiler (an option when using Java). Optimizes...
Read more >r.js - GitHub
A command line tool for running JavaScript scripts that use the Asynchronous Module Definition API (AMD) for declaring and using JavaScript modules and...
Read more >Add non-AMD modules before AMD modules - AMD Community
Hi I'm using requirejs for a project and I have 2 modules: a.js: is a non-AMD module that I cannot touch its code...
Read more >Can you help me understand the benefit of require.js?
You had a set of modules and compiled them into one file and did not use a module system - I am still...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey Folks, the latest version
v3.6.0
is now being built as a proper umd module. Hopefully that solves the problems you were having.You can load the script synchronously or edit the script (which you would need to do for each version upgrade).