michaldarda / parcel-rails

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

Parcel config as generated doesn't work #13

Open jyurek opened 5 years ago

jyurek commented 5 years ago

The documentation and generated initializer don't work. The generated config block, as created in https://github.com/michaldarda/parcel-rails/blob/master/lib/parcel/rails/parcel_generator.rb#L9-L12 do nothing, because parcel on line 9 is not a method and the block is never executed.

The README's version (https://github.com/michaldarda/parcel-rails#configuration) does work. In fact, it works perfectly well with the multiple-entry-point supporting parcel.

config.parcel.entry_points = %w(app/javascript/application.js app/javascript/another.js)

This line gets me this:

$ be rake parcel:compile
yarn run v1.12.3
$ /Users/jyurek/Development/studio/node_modules/.bin/parcel build app/javascript/application.js app/javascript/another.js -d public/parcels
✨  Built in 178ms.

public/parcels/application.js     1.13 KB    7ms
public/parcels/another.js         1.13 KB    6ms
public/parcels/application.map      327 B    3ms
public/parcels/another.map          325 B    3ms
✨  Done in 1.17s.

Which is exactly what I would expect.

Immortalin commented 5 years ago

@jyurek confirmed. The following block works as of Rails 5.2:

Rails.application.configure do
  config.parcel.entry_points = %w(app/assets/javascripts/application.js)
  config.parcel.destination = "public/parcels"
end

Pull request?

sumitngupta commented 5 years ago

Hi, I created a PR for the confirmed fix: https://github.com/michaldarda/parcel-rails/pull/14 . Let me know if there's anything else I can add with the change.

Cheers!

tadman commented 4 years ago

This is still an issue in the current version and takes some fussing to figure out (with the help of this ticket).