michaldarda / parcel-rails

Integration of Parcel Javascript module bundler with Rails
MIT License
68 stars 4 forks source link

No route matches [GET] "/application.map" #11

Open liepauls opened 5 years ago

liepauls commented 5 years ago

Hey, thanks for the gem!

After adding parcel-rails to my project, I keep getting error No route matches [GET] "/application.map on every page load. Everything seems to work, though.

I checked the example app and the issue is present there as well.

jtdowney commented 5 years ago

I noticed this as well. It appears to be because parcel-rails is telling parcel to start its server for HMR but serving the assets from the rails process. This causes a slight path confusion. I fixed this by using the following in my Procfile instead of bin/rails parcel:serve:

parcel: yarn parcel serve --public-url /parcels -d public/parcels app/javascript/application.js

The --public-url /parcels tells the parcel server to serve the files under /parcels like rails is, that way it generates the correct path to application.map.

sumitngupta commented 5 years ago

So I got a crappy commit set to let the parcel.rb configuration also set public-url flag on the yarn parcel command:

https://github.com/michaldarda/parcel-rails/commit/2257f8318ca38e5099af69eeb827f1da5868f703

I'm not the most prolific gem writer... I'd love to do it a better way that doesn't require the library to have to know about every single option parcel has as well as writing some tests for this. If someone has another gem or link to point me at, im happy to do the work get it done.