0
votes

I'm using a "core"-addon which contains logic that is used in multiple "boilerplate" - ember applications, when I build a boilerplate-application, the addon code is added to the "vendor.js" file found in the "assets"-folder. Is there a way I can make this code build to a separate "my-addon-vendor.js" file?

While browsing I found others with the same need, but an answer has yet to be found.

My "core"-addon is linked to my "boilerplate"-project using "npm link my-core-addon".

Thanks in advance

Versions:

  • Ember Version: 3.5.0
  • Ember CLI: 3.5.0
  • Node: 8.11.3
  • npm: 5.6.0
1
is there purely for optimization reasons? It would help to understand your need for this because there might be alternative solutions.mistahenry
Indeed for optimization and debugging reasons. We want our own custom addon(s) separated from our vendor file which is becoming very large.Bert Huys
you might have best luck discordapp.com/invite/zT3asNS joining the discord and asking in the ember-cli community chat. Your question is nuanced and it'd be easier to answer understanding more deeply the reasonsmistahenry

1 Answers

0
votes

You could do something like this:

  var qrScannerWorker = new Funnel(
    'node_modules/qr-scanner/', {
      include: ['qr-scanner-worker.min.js'],
      destDir: '/libraries/qr-scanner/'
    }
  );

https://github.com/NullVoxPopuli/emberclear/blob/master/packages/frontend/ember-cli-build.js#L139

this won't work for addons, but it'll work for underlying dependencies. So, if an addon is doing the bundling for you, you may want to do it yourself.