unabridged / motion

Reactive frontend UI components for Rails in pure Ruby
https://github.com/unabridged/motion
MIT License
697 stars 19 forks source link

Fix loading error with webpack 5+ #102

Closed jbbarth closed 2 years ago

jbbarth commented 3 years ago

When trying to upgrade a Rails app from webpacker 5 to 6 (still in beta but bear with me), I got the following error when launching webpack-dev-server:

ERROR in ./node_modules/@unabridged/motion/javascript/Component.js 19:8-15
Should not import the named export 'version' (imported as 'version') from default-exporting module (only default export is available soon)

It turns out I had to upgrade to webpack 5.x which provokes this error. If I understand the webpacker README correctly, webpack 5.x is already supposed to be supported in webpacker 5. Unclear to me if it's the default or if people tend to stick with webpack 4.x at this point.

Imo the change looks safe, but we may want to upgrade to webpack 5 in the test application to be sure. I tried to do so but got cryptic JS errors, and I'm unsure if you want to support both webpack 4.x and webpack 5.x in this project. I'm ready to try shaving this yak but I'll happily take your opinion before doing so ;-)

Thanks!

jbbarth commented 3 years ago

Fwiw the build is passing except for Ruby 3.0.0 where we're hitting something like https://github.com/mimemagicrb/mimemagic/issues/162

jbbarth commented 2 years ago

Closing this as I won't be able to move forward and I lost interest in making it work (switched job + they're removing Motion at my $OLD_JOB). Feel free to take my code if it helps.