File tree Expand file tree Collapse file tree 5 files changed +21
-4
lines changed Expand file tree Collapse file tree 5 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 22
33** Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
44
5+ ## [[ 5.3.0]] ( https://github.com/rails/webpacker/compare/v5.3.0...5.2.1 ) - 2021-TBD
6+
7+ - Adds experimental Yarn 2 support. Note you must manually set ` nodeLinker: node-modules ` in your ` .yarnrc.yml ` .
8+
59## [[ 5.2.1]] ( https://github.com/rails/webpacker/compare/v5.2.0...5.2.1 ) - 2020-08-17
610
711- Revert [ #1311 ] ( https://github.com/rails/webpacker/pull/1311 ) .
Original file line number Diff line number Diff line change 4242 run "yarn add @rails/webpacker@next"
4343end
4444
45+ package_json = File . read ( "#{ __dir__ } /../../package.json" )
46+ webpack_version = package_json . match ( /"webpack": "(.*)"/ ) [ 1 ]
47+ webpack_cli_version = package_json . match ( /"webpack-cli": "(.*)"/ ) [ 1 ]
48+
49+ # needed for experimental Yarn 2 support and should not harm Yarn 1
50+ say "Installing webpack and webpack-cli as direct dependencies"
51+ run "yarn add webpack@#{ webpack_version } webpack-cli@#{ webpack_cli_version } "
52+
4553say "Installing dev server for live reloading"
4654run "yarn add --dev webpack-dev-server"
4755
Original file line number Diff line number Diff line change @@ -9,13 +9,12 @@ namespace :webpacker do
99 pkg_path = Pathname . new ( "#{ __dir__ } /../../../package.json" ) . realpath
1010 yarn_range = JSON . parse ( pkg_path . read ) [ "engines" ] [ "yarn" ]
1111 is_valid = SemanticRange . satisfies? ( yarn_version , yarn_range ) rescue false
12- is_unsupported = SemanticRange . satisfies? ( yarn_version , ">=2 .0.0" ) rescue false
12+ is_unsupported = SemanticRange . satisfies? ( yarn_version , ">=3 .0.0" ) rescue false
1313
1414 unless is_valid
1515 $stderr. puts "Webpacker requires Yarn \" #{ yarn_range } \" and you are using #{ yarn_version } "
1616 if is_unsupported
1717 $stderr. puts "This version of Webpacker does not support Yarn #{ yarn_version } . Please downgrade to a supported version of Yarn https://yarnpkg.com/lang/en/docs/install/"
18- $stderr. puts "For information on using Webpacker with Yarn 2.0, see https://github.com/rails/webpacker/issues/2112"
1918 else
2019 $stderr. puts "Please upgrade Yarn https://yarnpkg.com/lang/en/docs/install/"
2120 end
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ namespace :webpacker do
55 node_env = ENV . fetch ( "NODE_ENV" ) do
66 valid_node_envs . include? ( Rails . env ) ? Rails . env : "production"
77 end
8- system ( { "NODE_ENV" => node_env } , "yarn install --no-progress --frozen-lockfile" )
8+ yarn_flags =
9+ if `yarn --version` . start_with? ( "1" )
10+ "--no-progress --frozen-lockfile"
11+ else
12+ "--immutable"
13+ end
14+ system ( { "NODE_ENV" => node_env } , "yarn install #{ yarn_flags } " )
915 end
1016end
Original file line number Diff line number Diff line change 99 ],
1010 "engines" : {
1111 "node" : " >=10.17.0" ,
12- "yarn" : " >=1 <2 "
12+ "yarn" : " >=1 <3 "
1313 },
1414 "dependencies" : {
1515 "@babel/core" : " ^7.11.1" ,
You can’t perform that action at this time.
0 commit comments