File tree 5 files changed +21
-4
lines changed
5 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
** Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
4
4
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
+
5
9
## [[ 5.2.1]] ( https://github.com/rails/webpacker/compare/v5.2.0...5.2.1 ) - 2020-08-17
6
10
7
11
- Revert [ #1311 ] ( https://github.com/rails/webpacker/pull/1311 ) .
Original file line number Diff line number Diff line change 42
42
run "yarn add @rails/webpacker@next"
43
43
end
44
44
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
+
45
53
say "Installing dev server for live reloading"
46
54
run "yarn add --dev webpack-dev-server"
47
55
Original file line number Diff line number Diff line change @@ -9,13 +9,12 @@ namespace :webpacker do
9
9
pkg_path = Pathname . new ( "#{ __dir__ } /../../../package.json" ) . realpath
10
10
yarn_range = JSON . parse ( pkg_path . read ) [ "engines" ] [ "yarn" ]
11
11
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
13
13
14
14
unless is_valid
15
15
$stderr. puts "Webpacker requires Yarn \" #{ yarn_range } \" and you are using #{ yarn_version } "
16
16
if is_unsupported
17
17
$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"
19
18
else
20
19
$stderr. puts "Please upgrade Yarn https://yarnpkg.com/lang/en/docs/install/"
21
20
end
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ namespace :webpacker do
5
5
node_env = ENV . fetch ( "NODE_ENV" ) do
6
6
valid_node_envs . include? ( Rails . env ) ? Rails . env : "production"
7
7
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 } " )
9
15
end
10
16
end
Original file line number Diff line number Diff line change 9
9
],
10
10
"engines" : {
11
11
"node" : " >=10.17.0" ,
12
- "yarn" : " >=1 <2 "
12
+ "yarn" : " >=1 <3 "
13
13
},
14
14
"dependencies" : {
15
15
"@babel/core" : " ^7.11.1" ,
You can’t perform that action at this time.
0 commit comments