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
bin/webpack[-dev-server] to webpacker[-dev-server] (#3252)
Renamed `/bin/webpack` to `/bin/webpacker` and `/bin/webpack-dev-server`
to `bin/webpacker-dev-server` to avoid confusion with underlying webpack
executables.
- Update static files path to from `media/` to `static/`.
23
23
24
24
### Breaking changes
25
+
- Renamed `/bin/webpack` to `/bin/webpacker` and `/bin/webpack-dev-server` to `bin/webpacker-dev-server` to avoid confusion with underlying webpack executables.
25
26
- Removed integration installers
26
27
- Splitchunks enabled by default
27
28
- CSS extraction enabled by default, except when devServer is configured and running
Copy file name to clipboardExpand all lines: README.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -206,44 +206,44 @@ Note, if you are using server-side rendering of JavaScript with dynamic code-spl
206
206
207
207
### Development
208
208
209
-
Webpacker ships with two binstubs: `./bin/webpack`and `./bin/webpack-dev-server`. Both are thin wrappers around the standard `webpack.js` and `webpack-dev-server.js` executables to ensure that the right configuration files and environmental variables are loaded based on your environment.
209
+
Webpacker ships with two binstubs: `./bin/webpacker`and `./bin/webpacker-dev-server`. Both are thin wrappers around the standard `webpack.js` and `webpack-dev-server.js` executables to ensure that the right configuration files and environmental variables are loaded based on your environment.
210
210
211
-
In development, Webpacker compiles on demand rather than upfront by default. This happens when you refer to any of the pack assets using the Webpacker helper methods. This means that you don't have to run any separate processes. Compilation errors are logged to the standard Rails log. However, this auto-compilation happens when a web request is made that requires an updated webpack build, not when files change. Thus, that can be painfully slow for front-end development in this default way. Instead, you should either run the `bin/webpack --watch` or run `./bin/webpack-dev-server`
211
+
In development, Webpacker compiles on demand rather than upfront by default. This happens when you refer to any of the pack assets using the Webpacker helper methods. This means that you don't have to run any separate processes. Compilation errors are logged to the standard Rails log. However, this auto-compilation happens when a web request is made that requires an updated webpack build, not when files change. Thus, that can be painfully slow for front-end development in this default way. Instead, you should either run the `bin/webpacker --watch` or run `./bin/webpacker-dev-server`
212
212
213
-
If you want to use live code reloading, or you have enough JavaScript that on-demand compilation is too slow, you'll need to run `./bin/webpack-dev-server` or `ruby ./bin/webpack-dev-server`. Windows users will need to run these commands in a terminal separate from `bundle exec rails s`. This process will watch for changes in the relevant files, defined by `webpacker.yml` configuration settings for `source_path`, `source_entry_path`, and `additional_paths`, and it will then automatically reload the browser to match. This feature is also known as [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/).
213
+
If you want to use live code reloading, or you have enough JavaScript that on-demand compilation is too slow, you'll need to run `./bin/webpacker-dev-server` or `ruby ./bin/webpacker-dev-server`. Windows users will need to run these commands in a terminal separate from `bundle exec rails s`. This process will watch for changes in the relevant files, defined by `webpacker.yml` configuration settings for `source_path`, `source_entry_path`, and `additional_paths`, and it will then automatically reload the browser to match. This feature is also known as [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/).
214
214
215
215
```bash
216
216
# webpack dev server
217
-
./bin/webpack-dev-server
217
+
./bin/webpacker-dev-server
218
218
219
219
# watcher
220
-
./bin/webpack --watch --progress
220
+
./bin/webpacker --watch --progress
221
221
222
222
# standalone build
223
-
./bin/webpack --progress
223
+
./bin/webpacker --progress
224
224
225
225
# Help
226
-
./bin/webpack help
226
+
./bin/webpacker help
227
227
228
228
# Version
229
-
./bin/webpack version
229
+
./bin/webpacker version
230
230
231
231
# Info
232
-
./bin/webpack info
232
+
./bin/webpacker info
233
233
```
234
234
235
235
Once you start this webpack development server, Webpacker will automatically start proxying all webpack asset requests to this server. When you stop this server, Rails will detect that it's not running and Rails will revert back to on-demand compilation _if_ you have the `compile` option set to true in your `config/webpacker.yml`
236
236
237
237
You can use environment variables as options supported by [webpack-dev-server](https://webpack.js.org/configuration/dev-server/) in the form `WEBPACKER_DEV_SERVER_<OPTION>`. Please note that these environmental variables will always take precedence over the ones already set in the configuration file, and that the _same_ environmental variables must be available to the `rails server` process.
By default, the webpack dev server listens on `localhost` in development for security purposes. However, if you want your app to be available over local LAN IP or a VM instance like vagrant, you can set the `host` when running `./bin/webpack-dev-server` binstub:
243
+
By default, the webpack dev server listens on `localhost` in development for security purposes. However, if you want your app to be available over local LAN IP or a VM instance like vagrant, you can set the `host` when running `./bin/webpacker-dev-server` binstub:
**Note:** You need to allow webpack-dev-server host as an allowed origin for `connect-src` if you are running your application in a restrict CSP environment (like Rails 5.2+). This can be done in Rails 5.2+ in the CSP initializer `config/initializers/content_security_policy.rb` with a snippet like this:
@@ -534,8 +534,8 @@ Please note, binstubs compiles in development mode however rake tasks compiles i
534
534
535
535
```bash
536
536
# Compiles in development mode unless NODE_ENV is specified, per the binstub source
537
-
./bin/webpack
538
-
./bin/webpack-dev-server
537
+
./bin/webpacker
538
+
./bin/webpacker-dev-server
539
539
540
540
# Compiles in production mode by default unless NODE_ENV is specified, per `lib/tasks/webpacker/compile.rake`
Copy file name to clipboardExpand all lines: docs/troubleshooting.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,15 @@
5
5
1. Read the error message carefully. The error message will tell you the precise key value
6
6
that is not matching what Webpack expects.
7
7
8
-
2. Put a `debugger` statement in your Webpack configuration and run `bin/webpack --debug-webpacker`.
8
+
2. Put a `debugger` statement in your Webpack configuration and run `bin/webpacker --debug-webpacker`.
9
9
If you have a node debugger installed, you'll see the Chrome debugger for your webpack
10
10
config. For example, install the Chrome extension
11
11
[NiM](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj) and
12
12
set the option for the dev tools to open automatically. Or put `chrome://inspect` in the URL bar.
13
13
For more details on debugging, see the official
14
14
[Webpack docs on debugging](https://webpack.js.org/contribute/debugging/#devtools)
15
15
16
-
3. Any arguments that you add to bin/webpack get sent to webpack. For example, you can pass `--debug` to switch loaders to debug mode. See [webpack CLI debug options](https://webpack.js.org/api/cli/#debug-options) for more information on the available options.
16
+
3. Any arguments that you add to bin/webpacker get sent to webpack. For example, you can pass `--debug` to switch loaders to debug mode. See [webpack CLI debug options](https://webpack.js.org/api/cli/#debug-options) for more information on the available options.
17
17
18
18
4. You can also pass additional options to the command to run the webpack-dev-server and start the webpack-dev-server with the option `--debug-webpacker`
19
19
@@ -50,7 +50,7 @@ Webpacker uses a `manifest.json` file to keep track of packs in all environments
50
50
however since this file is generated after packs are compiled by webpack. So,
51
51
if you load a view in browser whilst webpack is compiling you will get this error.
52
52
Therefore, make sure webpack
53
-
(i.e `./bin/webpack-dev-server`) is running and has
53
+
(i.e `./bin/webpacker-dev-server`) is running and has
54
54
completed the compilation successfully before loading a view.
55
55
56
56
@@ -79,7 +79,7 @@ bundle config --delete bin
79
79
## Running webpack on Windows
80
80
81
81
If you are running webpack on Windows, your command shell may not be able to interpret the preferred interpreter
82
-
for the scripts generated in `bin/webpack` and `bin/webpack-dev-server`. Instead you'll want to run the scripts
82
+
for the scripts generated in `bin/webpacker` and `bin/webpacker-dev-server`. Instead you'll want to run the scripts
## Invalid configuration object. webpack has been initialised using a configuration object that does not match the API schema.
91
91
92
-
If you receive this error when running `$ ./bin/webpack-dev-server` ensure your configuration is correct; most likely the path to your "packs" folder is incorrect if you modified from the original "source_path" defined in `config/webpacker.yml`.
92
+
If you receive this error when running `$ ./bin/webpacker-dev-server` ensure your configuration is correct; most likely the path to your "packs" folder is incorrect if you modified from the original "source_path" defined in `config/webpacker.yml`.
93
93
94
94
## Running Elm on Continuous Integration (CI) services such as CircleCI, CodeShip, Travis CI
Copy file name to clipboardExpand all lines: docs/v6_upgrade.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -104,14 +104,16 @@ See customization example the [Customizing Babel Config](./docs/customizing_babe
104
104
105
105
16. Review the new default's changes to `webpacker.yml` and `config/webpack`. Consider each suggested change carefully, especially the change to have your `source_entry_path` be at the top level of your `source_path`.
106
106
107
-
17. Make sure that you can run `bin/webpack` without errors.
107
+
17. Make sure that you can run `bin/webpacker` without errors.
108
108
109
109
18. Try running `RAILS_ENV=production bin/rails assets:precompile`. If all goes well, don't forget to clean the generated assets with `bin/rails assets:clobber`.
110
110
111
111
19. Run `yarn add webpack-dev-server` if those are not already in your dev dependencies. Make sure you're using v4+.
112
112
113
113
20. Try your app!
114
114
115
+
21. Update any scripts that called `/bin/webpack` or `bin/webpack-dev-server` to `/bin/webpacker` or `bin/webpacker-dev-server`
116
+
115
117
## Examples of v5 to v6
116
118
117
119
1. [React on Rails Project with HMR and SSR](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/compare/webpacker-5.x...master)
1. You forgot to install node packages (try `yarn install`) or are running an incompatible version of Node
109
109
2. Your app has code with a non-standard extension (like a `.jsx` file) but the extension is not in the `extensions` config in `config/webpacker.yml`
110
110
3. You have set compile: false (see `config/webpacker.yml`) for this environment
111
-
(unless you are using the `webpack -w` or the webpack-dev-server, in which case maybe you aren't running the dev server in the background?)
111
+
(unless you are using the `bin/webpacker -w` or the `bin/webpacker-dev-server`, in which case maybe you aren't running the dev server in the background?)
112
112
4. webpack has not yet re-run to reflect updates.
113
113
5. You have misconfigured Webpacker's `config/webpacker.yml` file.
114
114
6. Your webpack configuration is not creating a manifest.
0 commit comments