Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Webpacker the default JavaScript compiler for Rails 6 #33079

Merged
merged 54 commits into from Oct 1, 2018
Merged

Conversation

@dhh
Copy link
Member

dhh commented Jun 7, 2018

Make Webpacker the default Javascript compiler for Rails 6 with the following changes:

  • Webpacker gem is installed by default and webpacker:install is run by the Rails application generator.
  • Action Cable channel generators will create ES6 stubs rather than use CoffeeScript
  • Active Storage, Action Cable, Turbolinks, and Rails-UJS is loaded by a new application.js pack in app/javascript by default (unless any of the frameworks have been opted out).
  • Active Storage, Action Cable, Turbolinks, and Rails-UJS npm modules are automatically listed as dependencies in the default package.json.
  • All the JavaScript-related auxiliaries for Sprockets, like compression and uglifying, is no longer configured or included by default.
  • No JavaScript stubs will be created by default when using the scaffold generators any more.
@dhh dhh added this to the 6.0.0 milestone Jun 7, 2018
@simi

This comment has been minimized.

Copy link
Contributor

simi commented on 55d5a95 Jun 7, 2018

I think it is still valid to check no wild jQuery suddenly appears. :trollface:

else
GemfileEntry.new "mini_racer", nil, comment, { platforms: :ruby }, true
[ GemfileEntry.version("turbolinks", "~> 5",
"Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks") ]

This comment has been minimized.

Copy link
@yhirano55

yhirano55 Jun 7, 2018

Contributor

Turbolinks is added on package.json, so it looks unnecessary to add turbolinks to Gemfile.

This comment has been minimized.

Copy link
@yhirano55
@dhh
Copy link
Member Author

dhh commented Jun 7, 2018

@dhh
Copy link
Member Author

dhh commented Jun 19, 2018

@rainerborene
Copy link

rainerborene commented Jun 25, 2018

@dhh that means that sprockets will no longer be a dependency on Rails?

bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Oct 22, 2018
…by default

Related to rails#33079
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Oct 22, 2018
…by default

Related to rails#33079
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Oct 22, 2018
…ators [ci skip]

This option is unused since rails#33079.

Follow up rails#34277
@shashiprab
Copy link

shashiprab commented Nov 29, 2018

@dhh keeping my eyes peeled for the promised new JS framework for Rails 6.0 reveal! (Haven't found anything satisfying so far with either React, or Stimulus or Ember - hope its a new "Rails Way" framework)

@dhh
Copy link
Member Author

dhh commented Nov 29, 2018

@jakeNiemiec jakeNiemiec mentioned this pull request Dec 14, 2018
4 of 5 tasks complete
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Jan 13, 2019
Fix path to channel files.

`rails generate channel Chat` generetes `app/javascript/channels/chat_channel.js`.
See also,
railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt,
actioncable/lib/rails/generators/channel/templates/javascript/index.js.tt
by default `application.js` imports "channels", where
`app/javascript/channels/index.js` loads all the channels within
this directory and all subdirectories.

Follow up rails#34709
Related to rails#33079
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Jan 13, 2019
Fix path to channel files.

`rails generate channel Chat` generates `app/javascript/channels/chat_channel.js`.
See also,
railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt,
actioncable/lib/rails/generators/channel/templates/javascript/index.js.tt
by default `application.js` imports "channels", where
`app/javascript/channels/index.js` loads all the channels within
this directory and all subdirectories.

Follow up rails#34709
Related to rails#33079
suketa added a commit to suketa/rails_sandbox that referenced this pull request Jun 15, 2019
Make Webpacker the default JavaScript compiler for Rails 6
rails/rails#33079
suketa added a commit to suketa/rails_sandbox that referenced this pull request Jun 16, 2019
Make Webpacker the default JavaScript compiler for Rails 6
rails/rails#33079
bluz71 added a commit to bluz71/platters that referenced this pull request Jun 23, 2019
webpacker will be the default JavaScript compiler for Rails 6:

- rails/rails#33079

Note, webpacker and the asset pipeline can run side-by-side.

- webpacker and yarn are now used to manage: jquery, rails-ujs, turbolinks and
local-time JavaScript libraries.

- jQuery is exported globally from webpacker and is used in the asset
pipeline and JS remote responses

- the album tracks visibility JS sprinkle is now ES6 served by webpacker
instead CoffeeScript via the asset pipeline.

Upcoming work:

- Move/convert all CoffeeScript sprinkles from the asset pipeline to ES6 via
webpacker

- Replace Gemified Bootstrap via the asset pipeline with yarn and
webpacker managed Bootstrap (v3)

- Move images and stylesheets from the asset pipeline to webpacker

- Delete the asset pipeline
JoshAshby added a commit to transientBug/transientbug-rails that referenced this pull request Jul 20, 2019
seems like webpacker is increasingly the way to go for new js/css
asset work in rails with it being the default in rails 6, so lets
start working on transitioning to better practices and get some
rewrites of the old code in ( rails/rails#33079 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.