Permalink
Browse files

Switch from es2015 to latest: this includes es2015, es2016 and es2017

  • Loading branch information...
guilleiguaran committed Dec 20, 2016
1 parent 381c16c commit af320768eb5dfe82952238468021aea308a048d8
Showing with 5 additions and 5 deletions.
  1. +1 −1 lib/install/config/shared.js
  2. +1 −1 lib/install/template.rb
  3. +3 −3 lib/tasks/webpacker.rake
@@ -23,7 +23,7 @@ module.exports = {
exclude: /node_modules/,
loader: 'babel-loader',
options: {
- presets: ['es2015']
+ presets: ['latest']
}
},
{
View
@@ -13,7 +13,7 @@
public/packs/*
EOS
-run './bin/yarn add --dev webpack@beta webpack-merge path-complete-extname babel-loader babel-core babel-preset-es2015 coffee-loader coffee-script rails-erb-loader'
+run './bin/yarn add --dev webpack@beta webpack-merge path-complete-extname babel-loader babel-core babel-preset-latest coffee-loader coffee-script rails-erb-loader'
environment \
"# Make javascript_pack_tag lookup digest hash to enable long-term caching\n" +
View
@@ -26,11 +26,11 @@ namespace :webpacker do
config_path = Rails.root.join('config/webpack/shared.js')
config = File.read(config_path)
- if config.include?("presets: ['es2015']")
+ if config.include?("presets: ['latest']")
puts "Replacing loader presets to include react in #{config_path}"
- config.gsub!(/presets: \['es2015'\]/, "presets: ['react', 'es2015']")
+ config.gsub!(/presets: \['latest'\]/, "presets: ['react', 'latest']")
else
- puts "Couldn't automatically update loader presets in #{config_path}. Please set presets: ['react', 'es2015']."
+ puts "Couldn't automatically update loader presets in #{config_path}. Please set presets: ['react', 'latest']."
end
if config.include?("test: /\\.js(.erb)?$/")

2 comments on commit af32076

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Dec 20, 2016

Member

Member

dhh replied Dec 20, 2016

@hzoo

This comment has been minimized.

Show comment
Hide comment
@hzoo

hzoo Feb 26, 2017

Contributor

Also ❤️! I'd recommend switching to https://github.com/babel/babel-preset-env/ now to take advantage of compiling less based on browser (without options it acts the same as latest though), so in this case you can simply switch latest for env. We recommend doing that moving forward. https://twitter.com/addyosmani/status/807608316532756480

Contributor

hzoo replied Feb 26, 2017

Also ❤️! I'd recommend switching to https://github.com/babel/babel-preset-env/ now to take advantage of compiling less based on browser (without options it acts the same as latest though), so in this case you can simply switch latest for env. We recommend doing that moving forward. https://twitter.com/addyosmani/status/807608316532756480

Please sign in to comment.