Webpacker v3.0.0 Release Notes
Release Date: 2017-08-30 // over 6 years ago-
โ Added
resolved_paths
option 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
env
attribute onWebpacker::Compiler
allows setting custom environment variables that the compilation is being run with
Webpacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
๐ฅ Breaking changes
Note: requires running
bundle exec rails webpacker:install
config/webpack/**/*.js
:- โฌ๏ธ The majority of this config moved to the @rails/webpacker npm package.
webpacker:install
only createsconfig/webpack/{environment,development,test,production}.js
now 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
HMR
option for hot-module-replacementโ Add HTTPS
โ Removed
- Host info from manifest.json, now looks like this:
{ "hello_react.js": "/packs/hello_react.js" }
๐ Fixed
- Update
webpack-dev-server.tt
to respect RAILS_ENV and NODE_ENV values #502 - 0๏ธโฃ Use
0.0.0.0
as default listen address forwebpack-dev-server
- ๐ฑ Serve assets using
localhost
from dev server - #424
dev_server: host: localhost
- ๐ On Windows,
ruby bin/webpacker
andruby bin/webpacker-dev-server
will now bypass yarn, and execute vianode_modules/.bin
directly - #584
๐ฅ Breaking changes
- โ Add
compile
andcache_path
options toconfig/webpacker.yml
for 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. 0๏ธโฃ 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'