Including vendor dependencies in lazyloaded engines not working.
See original GitHub issueWith a clean ember-cli 2.12 and ember-engines 0.5.0 addon setting lazyloaded
to true throws an error when trying to find a vendor file I have added to the vendorTree.
Running ember server
on this repo will reproduce the issue. Changing the lazyloaded
to false you will be able to build the app.
I would expect highlightjs
and the shim
be added to engines-vendor.js
file.
The vendorTree
can be found here
module.exports = EngineAddon.extend({
name: 'vendor-lazy-engine',
lazyLoading: true,
included: function(app) {
this._super.included(app);
this.import('vendor/highlight.pack.js', {
exports: {
'highlight.js': [
'default',
'highlight',
'highlightAuto',
'highlightBlock'
]
}
});
this.import('vendor/shims/highlightjs.js');
},
treeForVendor() {
var tree = this._super.treeForVendor.apply(this, arguments);
let hljsPath = path.parse(require.resolve('highlightjs'));
let highlightTree = new Funnel(hljsPath.dir, {
files: [hljsPath.base],
});
let vendorTree = MergeTrees([tree, highlightTree]);
let debuggedTrees = debug(vendorTree, { name: 'vendorTree' });
return debuggedTrees
}
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Angular: Lazy-Loading Module not calling InjectionToken factory
I mean, it still has to go via the factory method that doesn't get called in the lazy-loaded module. Maybe it is because...
Read more >Lazy Load Angular 9+ Components - Brian F Love
Learn from a Google Developer Expert: Lazy loading components with Angular 9+ just got a lot easier!
Read more >Loading Third-Party JavaScript - web.dev
Third-party scripts are a predominant cause of performance slowdowns and are often caused by resources outside of your control. These issues can ...
Read more >Lazy Loading - Spartacus Documentation - SAP
The result is that you do not have to load all the JavaScript of the full ... Customizing Lazy Loaded Modules; Preparing Libraries...
Read more >A Guide to Managing Webpack Dependencies - Toptal
js, one of today's most popular JavaScript frameworks, module bundlers allow loading NPM modules in web browsers, and component-oriented libraries (like React) ...
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 FreeTop 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
Top GitHub Comments
@SanthoshRaju91 according to https://ember-cli.com/extending/
@Turbo87 and I recently overcame this by using an in-repo-addon. For example we generated an in-repo addon:
$ ember g in-repo-addon tl-mailcheck
Then added that addon as a dependency of the engine in it’s
package.json
:In the addons
index.js
:Note mailcheck is CommonJS and we want amd, so we’re using rollup to convert it… And our entry file
lib/index.js
just has import and export.Mailcheck dependency remains in the
package.json
for the host app, but appears only inengine-vendor.js
Also,
ember g in-reop-addon
will add that addon as a dependency of your main host app, so make sure to remove it from theember-addon
part of your mainpackage.json
(or you’ll get the dep invendor.js
as well).