| Summary: | CodeEdit: Webpack complains the code from "marked/marked". | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | libing wang <libingw> |
| Component: | Editor | Assignee: | libing wang <libingw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 12.0 | ||
| Target Milestone: | 13.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
The source code comes from https://github.com/chjj/marked/blob/master/lib/marked.js In Orion code base, the deferred.js has the similar pattern of code:
if (typeof define === "function" && define.amd) { //$NON-NLS-0$
define(factory);
} else if (typeof exports === "object") { //$NON-NLS-0$
module.exports = factory();
} else {
root.orion = root.orion || {};
root.orion.Deferred = factory();
}
|
End user who is trying to build their app with webpack found errors described as below: In built-codeEdit.js, the declare of module orion/hover is wrote as below: if (typeof exports === 'object') { module.exports = marked; } else if (typeof define === 'function' && define.amd) { define('marked/marked',[],function() { return marked; }); } else { this.marked = marked; } But when I import the js, there will be error After I change it to : if (typeof define === 'function' && define.amd) { define('marked/marked',[],function() { return marked; }); } else if (typeof exports === 'object') { module.exports = marked; } else { this.marked = marked; } everything is OK. So the amd should be checked first. I see other places amd are always checked first.