Coder Social home page Coder Social logo

parcel-rails's People

Contributors

hellojere avatar michaldarda avatar rickcarlino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

parcel-rails's Issues

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

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 <gem_dir>/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.

Handle HMR (hot-module-reloading)

Presently with the latest release of parcel-rails, I have to disable HMR via --no-hmr flag in my node scripts for running the parcel server (we're still on rails 4.2, so not using the binstubs). Do you have your setup running with HMR per chance?

If I leave HMR enabled i get an infinite reload on file change; parcel's output shows an Write EPIPE error, and nothing else.

Any thoughts? I'd love to chat with you on the parcel slack if you have time. It could just be as simple as "we only support things fully if you use Rails 5.x", which at least, knowing that, would help to in general, get past this particular error.

Also, would having my entry "html" point as a haml file be bad?

Thanks and please let me know what technical info I might be able to provide to help debug further.

Parcel does support multiple entry files

I don't know if this was always the case, but Parcel does support multiple entry files. It's in their Getting Started documentation. I think using a glob pattern pointed to /app/javascript/packs/**/* a la Webpacker would be a nice default. I don't know if just changing that setting will work right away, but seeing this incorrect or outdated information in the README makes me wonder whether this gem is being actively maintained or is abandoned.

Parcel config as generated doesn't work

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.

Gem Load Error is: uninitialized constant Rails::Generators

I just installed the gem and followed directions per the README.
My parcel.rb looks like this:

Rails.application.config.parcel do |parcel|
  parcel.entry_points = %w(webpack/entry.tsx)
  parcel.destination = 'public/parcels'
end

When I run rails parcel:serve I get this error:

rails aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'parcel-rails'.
Gem Load Error is: uninitialized constant Rails::Generators
Backtrace for gem load error is:
/whatever/gems/parcel-rails-0.9.2/lib/parcel/rails/parcel_generator.rb:3:in `<top (required)>'
/whatever/gems/parcel-rails-0.9.2/lib/parcel-rails.rb:5:in `<top (required)>'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `each'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `block in require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `each'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `require'
/whatever/gems/bundler-1.16.1/lib/bundler.rb:114:in `require'
/whatever/api/config/application.rb:8:in `<top (required)>'
/whatever/api/Rakefile:4:in `require'
/whatever/api/Rakefile:4:in `<top (required)>'
/whatever/rake-12.3.0/lib/rake/rake_module.rb:29:in `load'
/whatever/rake-12.3.0/lib/rake/rake_module.rb:29:in `load_rakefile'
/whatever/rake-12.3.0/lib/rake/application.rb:703:in `raw_load_rakefile'
/whatever/rake-12.3.0/lib/rake/application.rb:104:in `block in load_rakefile'
/whatever/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/whatever/rake-12.3.0/lib/rake/application.rb:103:in `load_rakefile'
/whatever/gems/railties-5.1.5/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/whatever/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/whatever/gems/railties-5.1.5/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/whatever/gems/railties-5.1.5/lib/rails/command.rb:46:in `invoke'
/whatever/gems/railties-5.1.5/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:80:in `block (2 levels) in require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `each'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `block in require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `each'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `require'
/whatever/gems/bundler-1.16.1/lib/bundler.rb:114:in `require'
/whatever/api/config/application.rb:8:in `<top (required)>'
/whatever/api/Rakefile:4:in `require'
/whatever/api/Rakefile:4:in `<top (required)>'
/whatever/gems/railties-5.1.5/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/whatever/gems/railties-5.1.5/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/whatever/gems/railties-5.1.5/lib/rails/command.rb:46:in `invoke'
/whatever/gems/railties-5.1.5/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'

Caused by:
NameError: uninitialized constant Rails::Generators
/whatever/gems/parcel-rails-0.9.2/lib/parcel/rails/parcel_generator.rb:3:in `<top (required)>'
/whatever/gems/parcel-rails-0.9.2/lib/parcel-rails.rb:5:in `<top (required)>'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `each'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `block in require'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `each'
/whatever/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `require'
/whatever/gems/bundler-1.16.1/lib/bundler.rb:114:in `require'
/whatever/api/config/application.rb:8:in `<top (required)>'
/whatever/api/Rakefile:4:in `require'
/whatever/api/Rakefile:4:in `<top (required)>'
/whatever/gems/railties-5.1.5/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/whatever/gems/railties-5.1.5/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/whatever/gems/railties-5.1.5/lib/rails/command.rb:46:in `invoke'
/whatever/gems/railties-5.1.5/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)

Sprockets integration

See how webpacker and breakfast does this.

Generate manifest, think about caching

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

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.