- For the changelog of versions prior to v6, see the 5.x stable branch of rails/webpacker.
- Please see the v8 Upgrade Guide for upgrading to version 8 and accounting for breaking changes.
- Please see the v7 Upgrade Guide for upgrading to new spelling in version 7.
- Please see the v6 Upgrade Guide to go from versions prior to v6.
- ShakaCode offers support for upgrading from Webpacker or using Shakapacker. If interested, contact Justin Gordon, [email protected].
next branch is for v8 changes
Changes since the last non-beta release.
- Changed internal
require
s torequire_relative
to make code less dependent on the load path. PR 516 by tagliala. - Allow configuring webpack from a Typescript file (
config/webpack/webpack.config.ts
). PR 524 by jdelStrother.
- Fix error when rails environment is required from outside the rails root directory PR 520
v8.0.2 - August 28, 2024
- Fix wrong instruction in esbuild loader documentation PR 504 by adriangohjw.
- Add logic to sass rule conditional on sass-loader version PR 508 by Judahmeek.
v8.0.1 - July 10, 2024
- Update outdated GitHub Actions to use Node.js 20.0 versions instead PR 497 by adriangohjw.
- Allow
webpack-merge
v6 to be used PR 502 by G-Rath.
-
Fixes failing tests for Ruby 2.7 due to
Rack::Handler::Puma.respond_to?(:config)
PR 501 by adriangohjw
v8.0.0 - May 17, 2024
See the v8 Upgrade Guide.
-
Removes CDN url from the manifest.json paths. PR 473 by tomdracz. This returns to the Webpacker behaviour prior to the aborted Webpacker v6.
-
Removes deprecated support of
Webpacker
spelling, config variables and constants. PR 429 by tomdracz.The usage of those has been deprecated in Shakapacker v7 and now fully removed in v8. See the v7 Upgrade Guide for more information if you are still yet to address this deprecation.
-
Remove
globalMutableWebpackConfig
global PR 439 by G-Rath.Use
generateWebpackConfig
instead. -
Use
package_json
gem to manage Node dependencies and commands, and usenpm
by default PR 430 by G-RathThis enables support for package managers other than
yarn
, withnpm
being the default; to continue using Yarn, specify it inpackage.json
using thepackageManager
property.This also removed
@node_modules_bin_path
,SHAKAPACKER_NODE_MODULES_BIN_PATH
, and support for installingShakapacker
's javascript package in a separate directory from the Gemfile containingShakapacker
's ruby gem. -
Remove
yarn_install
rake task, and stop installing js packages automatically as part ofassets:precompile
PR 412 by G-Rath. -
Remove
https
option forwebpack-dev-server
PR 414 by G-Rath. -
Enable
ensure_consistent_versioning
by default PR 447 by G-Rath. -
Asset files put in
additional_paths
will have their path stripped just like with thesource_path
. PR 403 by paypro-leon. -
Remove
isArray
utility (just useArray.isArray
directly) and renamed a few files PR 454 by G-Rath. -
Make JavaScript test helper utilities internal (
chdirTestApp
,chdirCwd
,resetEnv
) PR 458 by G-Rath.
v7.2.3 - March 23, 2024
- Emit warnings instead of errors when compilation is success but stderr is not empty. PR 416 by n-rodriguez.
- Allow
webpack-dev-server
v5. PR 418 by G-Rath
-
Uses config file passed in
SHAKAPACKER_CONFIG
consistently.PR 448 by tomdracz.Previously this could have been ignored in few code branches, especially when checking for available environments.
v7.2.2 - January 19, 2024
v7.2.1 - December 30, 2023
v7.2.0 - December 28, 2023
- Experimental support for other JS package managers using
package_json
gem PR 349 by G-Rath. - Support
hmr: only
configuration PR 378 by SimenB. - Use
config/shakapacker.yml
as the secondary source forasset_host
andrelative_url_root
configurations PR 376 by ahangarha.
- Recommend
server
option instead of the deprecatedhttps
option when--https
is provided PR 380 by G-Rath - Recompile assets on asset host change PR 364 by ahangarha.
- Add deprecation warning for
https
option inshakapacker.yml
(useserver: 'https'
instead) PR 382 by G-Rath. - Disable Hot Module Replacement in
webpack-dev-server
whenhmr: false
PR 392 by thedanbob.
- The usage of
relative_url_root
is deprecated in Shakapacker and will be removed in v8. PR 376 by ahangarha.
v7.1.0 - September 30, 2023
- Support passing custom webpack config directly to
generateWebpackConfig
for merging PR 343 by G-Rath.
- Use
NODE_OPTIONS
to enable Node-specific debugging flags PR 350. - Add the boilerplate
application.js
intopacks/
PR 363.
v7.0.3 - July 7, 2023
v7.0.2 - July 3, 2023
v7.0.1 - June 27, 2023
- Fixed the condition for showing warning for setting
useContentHash
tofalse
in the production environment. PR 320 by ahangarha.
v7.0.0 - June 23, 2023
-
Removes defaults passed to
@babel/preset-typescript
. PR 273 by tomdracz.@babel/preset-typescript
has been initialised in default configuration with{ allExtensions: true, isTSX: true }
- meaning every file in the codebase was treated as TSX leading to potential issues. This has been removed and returns to sensible default of the preset which is to figure out the file type from the extensions. This change might affect generated output however so it is marked as breaking. -
Export immutable webpackConfig function. PR 293 by tomdracz.
The
webpackConfig
property in theshakapacker
module has been updated to be a function instead of a global mutable webpack configuration. This function now returns an immutable webpack configuration object, which ensures that any modifications made to it will not affect any other usage of the webpack configuration. If a project still requires the old mutable object, it can be accessed by replacingwebpackConfig
withglobalMutableWebpackConfig
. Check v7-upgrade documentation for more detail.
- Set CSS modules mode depending on file type. PR 261 by talyuk.
- All standard webpack entries with the camelCase format are now supported in
shakapacker.yml
in snake_case format. PR276 by ahangarha. - The
shakapacker:install
rake task now has an option to force overriding files usingFORCE=true
environment variable PR311 by ahangarha. - Allow configuration of use of contentHash for specific environment PR 234 by justin808.
-
Rename Webpacker to Shakapacker in the entire project including config files, binstubs, environment variables, etc. with a high degree of backward compatibility.
This change might be breaking for certain setups and edge cases. More information: v7 Upgrade Guide PR157 by ahangarha
-
Set
source_entry_path
topacks
andnested_entries
totrue
inshakapacker.yml
PR 284 by ahangarha. -
Dev server configuration is modified to follow webpack recommended configurations for dev server. PR276 by ahangarha:
- Deprecated
https
entry is removed from the default configuration file, allowing to setserver
orhttps
as per the project requirements. For more detail, check webpack documentation. Thehttps
entry can be effective only if there is noserver
entry in the config file. allowed_hosts
is now set toauto
instead ofall
by default.
- Deprecated
-
Remove the arbitrary stripping of the top-level directory when generating static file paths. PR 283 by tomdracz.
Prior to this change, top level directory of static assets like images and fonts was stripped. This meant that file in
app/javascript/images/image.png
would be output tostatic/image.png
directory and could be referenced through helpers asimage_pack_tag("image.jpg")
orimage_pack_tag("static/image.jpg")
.Going forward, the top level directory of static files will be retained so this will necessitate the update of file name references in asset helpers. In the example above, the file sourced from
app/javascript/images/image.png
will be now output tostatic/images/image.png
and needs to be referenced asimage_pack_tag("images/image.jpg")
orimage_pack_tag("static/images/image.jpg")
.
-
Move compilation lock file into the working directory. PR 272 by tomdracz.
-
Process
source_entry_path
with values starting with/
as a relative path tosource_path
PR 284 by ahangarha. -
Removes defaults passed to
@babel/preset-typescript
to make it possible to have projects with mix of JS and TS code PR 273 by tomdracz.@babel/preset-typescript
has been initialised in default configuration with{ allExtensions: true, isTSX: true }
- meaning every file in the codebase was treated as TSX leading to potential issues. This has been removed and returns to sensible default of the preset which is to figure out the file type from the extensions. This change might affect generated output however so it is marked as breaking. -
Fixed RC version detection during installation. PR312 by ahangarha
-
Fix addition of webpack-dev-server to devDependencies during installation. PR310 by ahangarha
- Remove redundant enhancement for precompile task to run
yarn install
PR 270 by ahangarha. - Remove deprecated
check_yarn_integrity
fromShakapacker::Configuration
PR SP288 by ahangarha.
v6.6.0 - March 7, 2023
v6.5.6 - February 11, 2023
-
Fixed failing to update
bin/setup
file due to different formats of the file in different versions of Rails. PR 229 by ahangarha. -
Upgrade several JS dependencies to fix security issues. PR 243 by ahangarha.
-
Added
prepend_javascript_pack_tag
to helpers. Allows to move an entry to the top of queue. Handy when calling from the layout to make sure an entry goes before the view and partialappend_javascript_pack_tag
entries. PR 235 by paypro-leon. -
Fixed issue to support directories under
node_modules/*
in theadditional_paths
property ofwebpacker.yml
PR 240 by vaukalak. -
Remove unneeded code related to CSP config for generator. PR 223 by ahangarha.
v6.5.5 - December 28, 2022
- Describe keys different from
webpack-dev-server
in generatedwebpacker.yml
. PR 194 by alexeyr. - Allow webpack-cli v5 PR 216 by tagliala.
- Allow babel-loader v9 PR 215 by tagliala.
v6.5.4 - November 4, 2022
v6.5.3 - November 1, 2022
- Set RAILS_ENV and BUNDLE_GEMFILE env values before requiring
bundler/setup
,webpacker
, andwebpacker/webpack_runner
. PR 190 by betmenslido. - The
mini-css-extract-plugin
may cause various warnings indicating CSS order conflicts when using a File-System-based automated bundle generation feature. CSS order warnings can be disabled in projects where CSS ordering has been mitigated by consistent use of scoping or naming conventions. Addedcss_extract_ignore_order_warnings
flag to webpacker configuration to disable the order warnings by pulkitkkr in PR 192.
v6.5.2 - September 8, 2022
Remove the setting of the NODE_ENV in your bin/webpacker
and bin/webpacker-dev-server
files per PR 185.
- Changed NODE_ENV defaults to the following and moved from binstubs to the runner. PR 185 by mage1711.
ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development"
v6.5.1 - August 15, 2022
append_javascript_pack_tag
andappend_stylesheet_pack_tag
helpers returnnil
to prevent rendering the queue into view when using<%= … %>
ERB syntax. PR 167 by ur5us. While<%=
should not be used, it's OK to return nil in case it's misused.- Fixed non-runnable test due to wrong code nesting. PR 173 by ur5us.
- Fixed default configurations not working for custom Rails environments PR 168 by ur5us.
- Added accessor method for
nested_entries
configuration. PR 176 by pulkitkkr.
v6.5.0 - July 4, 2022
append_stylesheet_pack_tag
helper. It helps in configuring stylesheet pack names from the view for a route or partials. It is also required for filesystem-based automated Component Registry API on React on Rails gem. PR 144 by pulkitkkr.
v6.4.1 - June 5, 2022
-
Restores automatic installation of yarn packages removed in #131, with added deprecation notice. PR 140 by tomdracz.
This will be again removed in Shakapacker v7 so you need to ensure you are installing yarn packages explicitly before the asset compilation, rather than relying on this behaviour through
asset:precompile
task (e.g. Capistrano deployment). -
Disable Spring being used by
rails-erb-loader
. PR 141 by tomdracz.
v6.4.0 - June 2, 2022
- Fixed Issue 123: Rails 7.0.3 - Webpacker configuration file not found when running rails webpacker:install (shakapacker v6.3) in PR 136: Don't enhance precompile if no config #136 by justin808.
- Configuration boolean option
nested_entries
to use nested entries. This was the default prior to v6.0. Because entries maybe generated, it's useful to allow agenerated
subdirectory. PR 121 by justin808.
-
Allow v10 of
compression-webpack-plugin
as a peer dependency. PR 117 by aried3r. -
Remove assets:precompile task enhancement #131 by James Herdman: Removed the
yarn:install
Rake task, and no longer enhanceassets:precompile
with said task. These tasks were used to ensure required NPM packages were installed before asset precompilation. Going forward you will need to ensure these packages are already installed yourself. Should you wish to restore this behaviour you'll need to reimplement the task in your own application.
v6.3.0 - May 19, 2022
- Add ability to configure usage of either last modified timestamp and digest strategies when checking asset freshness. PR 112 by tomdracz.
- On Windows CSS urls no longer contain backslashes resulting in 404 errors. PR 115 by daniel-rikowski.
Note: Rubygem is 6.3.0.pre.rc.1 and NPM is 6.3.0-rc.1.
-
Remove Loose mode from the default @babel-preset/env configuration. PR 107 by Jeremy Liberman.
Loose mode compiles the bundle down to be compatible with ES5, but saves space by skipping over behaviors that are considered edge cases. Loose mode can affect how your code runs in a variety of ways, but in newer versions of Babel it's better to use Compiler Assumptions to have finer-grained control over which edge cases you're choosing to ignore.
This change may increase the file size of your bundles, and may change some behavior in your app if your code touches upon one of the edge cases where Loose mode differs from native JavaScript. There are notes in the linked PR about how to turn Loose mode back on if you need to, but consider migrating to Compiler Assumptions when you can. If you have already customized your babel config, this change probably won't affect you.
- Adds
webpacker_precompile
setting towebpacker.yml
to allow controlling precompile behaviour, similar to existingENV["WEBPACKER_PRECOMPILE"]
variable. PR 102 by Judahmeek. - Adds
append_javascript_pack_tag
helper. Allows for easier usage and coordination of multiple javascript packs. PR 94 by tomdracz.
-
Use last modified timestamps rather than file digest to determine compiler freshness. PR 97 by tomdracz.
Rather than calculating SHA digest of all the files in the paths watched by the compiler, we are now comparing the modified time of the
manifest.json
file versus the latest modified timestamp of files and directories in watched paths. Unlike calculating digest, which only looked at the files, the new calculation also considers directory timestamps, including the parent ones (i.e.config.source_path
folder timestamp will be checked together will timestamps of all files and directories inside of it).This change should result in improved compiler checks performance but might be breaking for certain setups and edge cases. If you encounter any issues, please report them at https://github.com/shakacode/shakapacker/issues.
-
Bump dependency versions in package.json to address security vulnerabilities. PR 109 by tomdracz.
-
Add
webpack-dev-server
aspeerDependency
to make its usage clear. PR 109 by tomdracz.
v6.2.1 - April 15, 2022
v6.2.0 - March 22, 2022
- Make manifest_path configurable, to keep manifest.json private if desired. PR 78 by jdelStrother.
- Rewrite webpack module rules as regular expressions. Allows for easy iteration during config customization. PR 60 by blnoonan.
- Initialization check to ensure shakapacker gem and NPM package version are consistent. Opt-in behaviour enabled by setting
ensure_consistent_versioning
configuration variable. PR 51 by tomdracz. - Add
dev_server.inline_css: bool
config option to allow for opting out of style-loader and into mini-css-extract-plugin for CSS HMR in development. PR 69 by cheald.
- Increase default connect timeout for dev server connections, establishing connections more reliably for busy machines. PR 74 by stevecrozz.
- Allow multiple invocations of stylesheet_pack_tag (eg for a regular stylesheet & a print stylesheet). PR 82 by jdelStrother.
- Tweak swc config for parity with Babel. PR 79 by dleavitt.
v6.1.1 - February 6, 2022
v6.1.0 - February 4, 2022
- Static asset subdirectories are retained after compilation, matching Webpacker v5 behaviour. PR 47 by tomdracz. Fixes issues rails/webpacker#2956 which broke in rails/webpacker#2802.
v6.0.2 - January 25, 2022
- Fix incorrect command name in warning. PR 33 by tricknotes.
v6.0.1 - January 24, 2022
- PR #21 removed pnp-webpack-plugin as a dev dependency but did not remove it from the peer dependency list. PR 30 by t27duck.
v6.0.0 changes from v6.0.0.rc.6 - January 22, 2022
- Raise on multiple invocations of javascript_pack_tag and stylesheet_pack_tag helpers. PR 19 by tomdracz.
- Remove automatic addition of node_modules into rails asset load path. PR 20 by tomdracz.
- Remove pnp-webpack-plugin. PR 21 by tomdracz.
- Make watched_files_digest thread safe. rails/webpacker #3233
- Use single webpack config webpack.config.js. rails/webpacker #3240
- Switch to peer dependencies. rails/webpacker #3234
- Single default configuration file of
config/webpack/webpack.config.js
. Previously, the config file was set toconfig/webpack/#{NODE_ENV}.js
. - Changed all package.json dependencies to peerDependencies, so upgrading requires adding the dependencies, per the UPGRADE GUIDE.
v6.0.0.rc.6 changes from v5.4 - Forked January 16, 2022
-
node_modules
will no longer be babel transformed compiled by default. This primarily fixes rails issue #35501 as well as numerous other webpacker issues. The disabled loader can still be required explicitly via:const nodeModules = require('@rails/webpacker/rules/node_modules.js') environment.loaders.append('nodeModules', nodeModules)
-
If you have added
environment.loaders.delete('nodeModules')
to yourenvironment.js
, this must be removed or you will receive an error (Item nodeModules not found
). -
extract_css
option was removed. Webpacker will generate a separateapplication.css
file for the defaultapplication
pack, as supported by multiple files per entry introduced in 5.0.0. #2608. However, CSS will be inlined when the webpack-dev-server is used withhmr: true
. JS package exportsinliningCss
. This is useful to enable HMR for React. -
Webpacker's wrapper to the
splitChunks()
API will now defaultruntimeChunk: 'single'
which will help prevent potential issues when using multiple entry points per page #2708. -
Changes
@babel/preset-env
modules option to'auto'
per recommendation in the Babel docs #2709 -
Adds experimental Yarn 2 support. Note you must manually set
nodeLinker: node-modules
in your.yarnrc.yml
. -
Fixes dev server issues #2898
-
Update static files path to from
media/
tostatic/
. -
Deprecated configuration option
watched_paths
. Useadditional_paths
instead inwebpacker.yml
.
- Renamed
/bin/webpack
to/bin/webpacker
and/bin/webpack-dev-server
tobin/webpacker-dev-server
to avoid confusion with underlying webpack executables. - Removed integration installers
- Splitchunks enabled by default
- CSS extraction enabled by default, except when devServer is configured and running