Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimized es-module-shims + @hotwired/stimulus-loading in Safari #74

Closed
tomasc opened this issue Nov 23, 2021 · 5 comments
Closed

Minimized es-module-shims + @hotwired/stimulus-loading in Safari #74

tomasc opened this issue Nov 23, 2021 · 5 comments

Comments

@tomasc
Copy link
Contributor

tomasc commented Nov 23, 2021

Upgrading to importmap-rails v0.9.0 results in issues with eager- or lazyLoad of Stimulus controllers (using @hotwired/stimulus-loading).

= javascript_importmap_tags

JS console:

Failed to autoload controller: modulor--view-components--grid--component
Error: Unable to resolve specifier 'controllers/modulor/view_components/grid/component_controller' from http://127.0.0.1:3010/assets/stimulus-loading-685d40a0b68f785d3cdbab1c0f3575320497462e335c4a63b8de40a355d883c0.js
throwUnresolved — es-module-shims.min.source.js:2
(anonymous function) — es-module-shims.min.source.js:2
asyncFunctionResume
(anonymous function)
promiseReactionJobWithoutPromise

I was able to find out that switching to non-minified version of es-module-shims resolves the issue

= javascript_importmap_tags shim: false
= javascript_importmap_shim_tag minimized: false
@dhh
Copy link
Member

dhh commented Nov 23, 2021

You don't have a controller called modulor--view-components--grid--component? I can't replicate the problem in a sample app. Could you try to boil this down to a reproducible case? Thanks!

@mhenrixon
Copy link

mhenrixon commented Nov 23, 2021

I have a similar problem: https://discuss.hotwired.dev/t/importmap-rails-0-9-0-broke-stimulus/3506

After upgrading to importmap-rails-0.9.0 I get the error that controllers that were found before are not anymore. If I change from:

<%= javascript_importmap_tags %>

To:

<%= javascript_importmap_tags shim: false %>
<%= javascript_importmap_shim_tag minimized: false %>

It seems to work but then I get console errors that say:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (es-module-shims.js-3e1cdc93efd2cfa4a56543627a4e60e31cf90a9336602e161f327d4be5b5e15a.map, line 0)

EDIT:

For me it is the same in every browser, not just safari. The below image is from Firefox:
CleanShot 2021-11-23 at 19 56 23@2x

@tomasc
Copy link
Contributor Author

tomasc commented Nov 23, 2021

@dhh I do have that controller — switching to non-minified version of the shims makes everything work fine again (however I also see the JS error about missing .map file as @mhenrixon described above). It seems to me the .min and .map versions of the shims packaged with the 0.9.0 release are somehow corrupted. I will try to find time to investigate more tomorrow.

@dhh
Copy link
Member

dhh commented Nov 24, 2021

There was an error with the minified version that was included. Released 0.9.1 with the correction. Should be all good. Thanks for reporting!

@dhh dhh closed this as completed Nov 24, 2021
@tomasc
Copy link
Contributor Author

tomasc commented Nov 24, 2021

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants