ember-cli / ember-twiddle

JSFiddle type thing for ember-cli style code
https://ember-twiddle.com
MIT License
268 stars 97 forks source link

In addon consuming dynamic imports via ember-auto-import chunk not found #723

Open gabrielgrant opened 4 years ago

gabrielgrant commented 4 years ago

Example: https://ember-twiddle.com/c9f21301be20398fdd75f7d4a38f73d1?openFiles=templates.application%5C.hbs%2C

Error: error rendering mapbox-gl Error: "Loading chunk 0 failed. (error: https://addons.ember-twiddle.com/ember-3.18.0/ember-mapbox-gl/1.0.1/chunk.cf2b9ca2730293fd972d.js)" onScriptComplete Ember

The request inspector shows a 403 response from a request to https://addons.ember-twiddle.com/ember-3.18.0/ember-mapbox-gl/1.0.1/chunk.cf2b9ca2730293fd972d.js :

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>EF10342DBE364C13</RequestId><HostId>51fFbO8IBpAh4H2yzPPBCVWjHLhqYNUU8pVyJvD8M6icJg7QxGb1G7XmpMq5T6SO+VfoLuAl+Ag=</HostId></Error>
Gaurav0 commented 4 years ago

Changing title to indicate underlying issue.

Gaurav0 commented 4 years ago

@ef4 Here is another issue with ember-auto-import and ember-twiddle.

gabrielgrant commented 4 years ago

Thanks for taking a look/tracking down the root cause. Is there any way to work around this at the moment?

Gaurav0 commented 4 years ago

@gabrielgrant Even if you could work around this issue, ember twiddle uses a sandboxed iframe for security reasons. From a sandboxed iframe, you may not access an external api, or use web workers. But thanks for bringing this issue to my attention.

ef4 commented 4 years ago

You may be able to avoid this problem the same way fastboot does — by preloading all lazy chunks.

In an app with fastboot, we always emit a file named auto-import-fastboot.js that is the concatenation of all the lazy chunks. Adding a script tag for that before the app.js script should work.

On Thu, Jun 11, 2020 at 6:51 PM Gaurav Munjal notifications@github.com wrote:

@gabrielgrant https://github.com/gabrielgrant Even if you could work around this issue, ember twiddle uses a sandboxed iframe for security reasons. From a sandboxed iframe, you may not access an external api, or use web workers. But thanks for bringing this issue to my attention.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ember-cli/ember-twiddle/issues/723#issuecomment-642969879, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACN6MXSCYWXQP5EMFYMKCDRWFNWFANCNFSM4N3SKZMA .

Gaurav0 commented 4 years ago

@ef4 is there some way we can force ember-auto-import to do a completely static build and include everything in the vendor tree?

ef4 commented 4 years ago

auto-import allows you to pass options through to webpack, so you may be able to use something like LimitChunkCountPlugin with a limit of 1 to force everything into one chunk file.