michaldarda / parcel-rails

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

Entry points and destination values defined in config/initializers/parcel.rb are not being used #9

Open mickmister opened 6 years ago

mickmister commented 6 years ago

I am attempting to change the location of the application's entry point, as well as the destination. Following the guide in the README, I have changed the values in config/initializers/parcel.rb to be the following:

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

I then receive the following output from the console, from running bundle exec rake assets:precompile

<root>/node_modules/.bin/parcel build app/javascript/application.js -d public/parcels
 Cannot find module '<root>/app/javascript/application.js'  at Resolver.resolve (<root>/node_modules/parcel-bundler/src/Resolver.js:70:17)

I am able to fix this by editing /parcel-rails-0.9.3/lib/parcel-rails.rb and changing the block

config.parcel.entry_points = %w[app/javascript/application.js]
config.parcel.destination = 'public/parcels'

to

config.parcel.entry_points = %w(app/assets/javascripts/application.js)
config.parcel.destination = 'public/assets'

Obviously this is a hacky fix. I want to know if this is something I can help look into. I've browsed the repo and I haven't figured out where the initializer is supposed to override the value set in the lib/parcel-rails.rb file that is within the library.

hellojere commented 5 years ago

Agree, this seems to have no effect.