dustjs
dustjs copied to clipboard
Dustjs incompatible with almond
When upgraded from 2.5 to 2.7 dustjs is supposed to support AMD without shim or other wrappers.
When I load the script dynamically it works fine. When I build a minified version and run it with almond, I get the error:
... missing dust
Here is the code I am running:
...
paths: {
"dust": "/bower_components/dustjs-linkedin/dist/dust-full.min",
...
define(function(require, exports, module) {
require(["dust"], function(dust) {
console.log("DUST IS ", dust)
});
});
and I build it with r.js and almond:
name: "../../bower_components/almond/almond",
Here is almond:
- https://github.com/requirejs/almond
Your minifier is prolly removing the dust global. Look for the variable dust in your minified code. If it is not there tell your minifier to not minify that global keyword On Tue, Sep 6, 2016 at 5:59 AM Andreas Åkre Solberg < [email protected]> wrote:
When upgraded from 2.5 to 2.7 dustjs is supposer to support AMD without shim or other wrappers.
When I load the script dynamically it works fine. When I build a minified version and run it with almond, I get the error:
... missing dust
Here is the code I am running:
... paths: { "dust": "/bower_components/dustjs-linkedin/dist/dust-full.min",...define(function(require, exports, module) { require(["dust"], function(dust) { console.log("DUST IS ", dust) }); });
and I build it with r.js and almond:
name: "../../bower_components/almond/almond",
Here is almond:
- https://github.com/requirejs/almond
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/linkedin/dustjs/issues/742, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr2hwMItxEbxMMijqQok3Fl4Y7f6bcLks5qnWPFgaJpZM4J1zyQ .
It shouldn't need the global, almond is an AMD loader so it should be using the AMD define. I'll take a look.
with regards to minifier I have turned that off, using "optimize": "none"
I am pretty sure that it's r.js that Dust doesn't play well with because dust-full contains multiple defines (created by the build concatenating the core with the compiler) and this gives lots of tools fits.
Do you have a repo I can look at?
Not at the moment. I'll debug some more later today, and I may prepare some code if needed.
You can have a look at this for now:
https://gist.github.com/andreassolberg/6a8406b8746fa5f5f12bb1eb3b039512
When I replace almond.js with require.js in the name propery of build.js it works.
Excellent, thanks so much for the reduced case.