embroider-build / ember-auto-import

Zero config import from npm packages
Other
361 stars 110 forks source link

Cannot dynamically import multiple paths from same library #190

Open knownasilya opened 5 years ago

knownasilya commented 5 years ago

I'm trying a dynamic import with const ol = await import('ol');. I can access ol.Map and ol.View, but not ol.layer.TileLayer as shown on their npm page here: https://www.npmjs.com/package/ol#getting-started

I tried importing ol/layer which works, but when I try importing both ol and ol/layer in a hash

  async importOl() {
    let ol = await hash({
      ol: import('ol'),
      layer: import('ol/layer'),
      source: import('ol/source')
    });

    return ol;
  }

Code can be found here https://github.com/knownasilya/ember-glimmer-components-test/blob/setup-ol/app/components/map/component.js#L12

I get this error

vendor-suffix.js:1 Uncaught (in promise) TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (vendor-suffix.js:1)
__webpack_require__ @ vendor-suffix.js:1
async function (async)
setupMap @ component.js:39
installModifier @ did-insert.js:14
install @ ember-modifier-manager-polyfill.js:88
commit @ runtime.js:2014
commit @ runtime.js:2064
commit @ glimmer.js:2790
_renderRoots @ glimmer.js:3922
_renderRootsTransaction @ glimmer.js:3946
_renderRoot @ glimmer.js:3885
_appendDefinition @ glimmer.js:3820
appendOutletView @ glimmer.js:3810
invoke @ backburner.js:249
flush @ backburner.js:168
flush @ backburner.js:320
_end @ backburner.js:750
end @ backburner.js:553
_run @ backburner.js:793
_join @ backburner.js:770
join @ backburner.js:593
join @ index.js:164
args @ index.js:256
mightThrow @ jquery.js:3534
process @ jquery.js:3602
setTimeout (async)
(anonymous) @ jquery.js:3640
fire @ jquery.js:3268
fireWith @ jquery.js:3398
fire @ jquery.js:3406
fire @ jquery.js:3268
fireWith @ jquery.js:3398
ready @ jquery.js:3878
completed @ jquery.js:3888

I also tried importing one after the other, no luck. Not sure if it's related to this issue https://github.com/ef4/ember-auto-import/issues/133, since I get a different error.

knownasilya commented 5 years ago

The workaround in https://github.com/ef4/ember-auto-import/issues/133#issuecomment-437645242 did not help.

knownasilya commented 5 years ago

Oh, and vendor-suffix.js seems to be empty.

NullVoxPopuli commented 9 months ago

is this still an issue in ember-auto-import@v2?