- Allow dev server connect timeout (in seconds) to be configurable, default: 0.01
# Change to 1s
Webpacker.dev_server.connect_timeout = 1-
Missing
node_modules/.bin/*files by bumping minimum Yarn version to 0.25.2 #727 -
webpacker:compiletask so that fails properly when webpack compilation fails #728 -
Rack dev server proxy middleware when served under another proxy (example: pow), which uses
HTTP_X_FORWARDED_HOSTheader resulting in404for webpacker assets -
Make sure tagged logger works with rails < 5 #716
-
Allow webpack dev server listen host/ip to be configurable using additional
--listen-hostoption./bin/webpack-dev-server --listen-host 0.0.0.0 --host localhost
watchContentBasefrom devServer config so it doesn't unncessarily trigger live reload when manifest changes. If you have applied this workaround from #724, please revert the change fromconfig/webpack/development.jssince this is now fixed.
resolved_pathsoption to allow adding additional paths webpack should lookup when resolving modules
# config/webpacker.yml
# Additional paths webpack should lookup modules
resolved_paths: [] # empty by default-
Webpacker::Compiler.fresh?andWebpacker::Compiler.stale?answer the question of whether compilation is needed. The oldWebpacker::Compiler.compile?predicate is deprecated. -
Dev server config class that exposes config options through singleton.
Webpacker.dev_server.running?
-
Rack middleware proxies webpacker requests to dev server so we can always serve from same-origin and the lookup works out of the box - no more paths prefixing
-
envattribute onWebpacker::Compilerallows setting custom environment variables that the compilation is being run withWebpacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
Note: requires running bundle exec rails webpacker:install
config/webpack/**/*.js:
- The majority of this config moved to the @rails/webpacker npm package.
webpacker:installonly createsconfig/webpack/{environment,development,test,production}.jsnow so if you're upgrading from a previous version you can remove all other files.
webpacker.yml:
-
Move dev-server config options under defaults so it's transparently available in all environments
-
Add new
HMRoption for hot-module-replacement -
Add HTTPS
-
Host info from manifest.json, now looks like this:
{ "hello_react.js": "/packs/hello_react.js" }
- Update
webpack-dev-server.ttto respect RAILS_ENV and NODE_ENV values #502 - Use
0.0.0.0as default listen address forwebpack-dev-server - Serve assets using
localhostfrom dev server - #424
dev_server:
host: localhost- On Windows,
ruby bin/webpackerandruby bin/webpacker-dev-serverwill now bypass yarn, and execute vianode_modules/.bindirectly - #584
-
Add
compileandcache_pathoptions toconfig/webpacker.ymlfor configuring lazy compilation of packs when a file under tracked paths is changed #503. To enable expected behavior, updateconfig/webpacker.yml:default: &default cache_path: tmp/cache/webpacker test: compile: true development: compile: true production: compile: false
-
Make test compilation cacheable and configurable so that the lazy compilation only triggers if files are changed under tracked paths. Following paths are watched by default -
["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
To add more paths:
# config/initializers/webpacker.rb or config/application.rb Webpacker::Compiler.watched_paths << 'bower_components'
-
Update
.babelrcto fix compilation issues - #306 -
Missing asset host when defined as a
Procor onActionController::Base.asset_hostdirectly - #397 -
Incorrect asset host when running
webpacker:compileorbin/webpackin development mode - #397 -
Update
webpacker:compiletask to usestdoutandstderrfor better logging - #395 -
ARGV support for
webpack-dev-server- #286
-
Elm support. You can now add Elm support via the following methods:
- New app:
rails new <app> --webpack=elm - Within an existing app:
rails webpacker:install:elm
- New app:
-
Support for custom
public_output_pathpaths independent ofsource_entry_pathinconfig/webpacker.yml.outputis also now relative topublic/. - #397Before (compile to
public/packs):source_entry_path: packs public_output_path: packs
After (compile to
public/sweet/js):source_entry_path: packs public_output_path: sweet/js
-
httpsoption to usehttpsmode, particularly on platforms like - https://community.c9.io/t/running-a-rails-app/1615 or locally - #176 -
[Babel] Dynamic import() and Class Fields and Static Properties babel plugin to
.babelrc
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],
"plugins": [
"syntax-dynamic-import",
"transform-class-properties", { "spec": true }
]
}- Source-map support for production bundle
-
Consolidate and flatten
paths.ymlanddevelopment.server.ymlconfig into one file -config/webpacker.yml- #403. This is a breaking change and requires you to re-install webpacker and cleanup old configuration files.bundle update webpacker bundle exec rails webpacker:install # Remove old/unused configuration files rm config/webpack/paths.yml rm config/webpack/development.server.yml rm config/webpack/development.server.js
Warning: For now you also have to add a pattern in
.gitignoreby hand./public/packs +/public/packs-test /node_modules
Some of the changes made requires you to run below commands to install new changes.
bundle update webpacker
bundle exec rails webpacker:install
-
Support Spring - #205
Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
-
Check node version and yarn before installing webpacker - #217
-
Include webpacker helper to views - #172
-
Webpacker installer on windows - #245
-
Yarn duplication - #278
-
Add back Spring for
rails-erb-loader- #216 -
Move babel presets and plugins to .babelrc - #202
-
A changelog - #211
-
Minimize CSS assets - #218
-
Pack namespacing support - #201
For example:
app/javascript/packs/admin/hello_vue.js app/javascript/packs/admin/hello.vue app/javascript/packs/hello_vue.js app/javascript/packs/hello.vue -
Add tree-shaking support - #250
-
Add initial test case by @kimquy #259
-
Compile assets before test:controllers and test:system
- Webpack watcher - #295
This release requires you to run below commands to install new features.
bundle update webpacker
bundle exec rails webpacker:install
# if installed react, vue or angular
bundle exec rails webpacker:install:[react, angular, vue]
config.x.webpacker[:digesting] = true