You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove the yarn integrity check
The `yarn check` command has been removed in Yarn 2.0.
The yarn integrity check in Webpacker has commonly been a source of
confusion and frustration among developers. Its behavior at times does
not always match expectation.
Yarn's maintainer has described `yarn check` as buggy and discourages
its use: yarnpkg/yarn#6427 (comment)
This PR removes the yarn integrity check from the Webpacker railtie as
well as references to its setting in Webpacker::Configuration.
The Webpacker::Configuration#check_yarn_integrity= method has been left
in with a deprecation warning to avoid a breaking change.
* Add deployment note in README
It's recommended to use `yarn install --frozen-lockfile` in a deployment
context prior to compiling assets for production. This practice may help
offset potential concerns with the removal of the yarn integrity check,
at least in production environemnts.
* Update README with note about yarn install
When `package.json` and/or `yarn.lock` changes, such as when pulling down changes to your local environemnt in a team settings, be sure to keep your NPM packages up-to-date:
110
+
111
+
```bash
112
+
yarn install
113
+
```
114
+
110
115
### Usage
111
116
112
117
Once installed, you can start writing modern ES6-flavored JavaScript apps right away:
By default, in development, webpacker runs a yarn integrity check to ensure that all local JavaScript packages are up-to-date. This is similar to what bundler does currently in Rails, but for JavaScript packages. If your system is out of date, then Rails will not initialize. You will be asked to upgrade your local JavaScript packages by running `yarn install`.
306
-
307
-
To turn off this option, you will need to change the default setting in `config/webpacker.yml`:
308
-
309
-
```yaml
310
-
# config/webpacker.yml
311
-
development:
312
-
...
313
-
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
314
-
check_yarn_integrity: false
315
-
```
316
-
317
-
You may also turn on this feature by adding the config option for any Rails environment in `config/webpacker.yml`:
318
-
319
-
```yaml
320
-
check_yarn_integrity: true
321
-
```
322
-
323
308
## Integrations
324
309
325
310
Webpacker ships with basic out-of-the-box integration. You can see a list of available commands/tasks by running `bundle exec rails webpacker`.
Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`. Similar to sprockets both rake tasks will compile packs in production mode but will use `RAILS_ENV` to load configuration from `config/webpacker.yml` (if available).
415
400
401
+
When compiling assets for production on a remote server, such as a continuous integration environment, it's recommended to use `yarn install --frozen-lockfile` to install NPM packages on the remote host to ensure that the installed packages match the `yarn.lock` file.
Copy file name to clipboardExpand all lines: lib/webpacker/configuration.rb
+1-5
Original file line number
Diff line number
Diff line change
@@ -64,11 +64,7 @@ def extensions
64
64
end
65
65
66
66
defcheck_yarn_integrity=(value)
67
-
data[:check_yarn_integrity]=value
68
-
end
69
-
70
-
defcheck_yarn_integrity?
71
-
fetch(:check_yarn_integrity)
67
+
warn"Webpacker::Configuration#check_yarn_integrity=(value) has been deprecated. The integrity check has been removed from Webpacker so changing this setting will have no effect."
0 commit comments