Replacing webpack with rspack! π
- Breaking change: Replaces
webpack
withrspack
- this adds a significant performance boost to jetpack. This is largely backwards compatible. However, if you customise your webpack in jetpack.config.js you might need to read the rspack migration guides. - Breaking change: Replaces
postcss
with the fasterlightningcss
via rspack's builtin loaders. It serves the same purpose of lowering css syntax for older browsers. - Upgrade
sass-loader
to use the modernsass-embedded
which is significantly faster, this should be backwards compatible, but expect sass warnings if you're using older sass syntax.
- Adds
chunkLoadRetry
option for reloading chunks - Upgrade all dependencies
- Breaking change: styles are exported as named exports, so you must now write
import * as style from "./style.css"
, see https://github.com/webpack-contrib/css-loader/releases/tag/v7.0.0 for further details - Upgrade all dependencies
- Upgrade all dependencies
- Add support for
jetpack.config.cjs
in addition tojetpack.config.js
- helps in ESM native Node.js projects
- Upgrade all dependencies
- Fix the
-x, -exec
command
- Fix: Correctly parse the
--config
command line arg. - Patch dependencies via npm audit
- Upgrade all dependencies
- Remove preact example, since the example was out of date
- Upgrade all dependencies
- Jetpack has been used in prod for years now and deserves a 1.0.0 π₯³
- Upgrade to webpack 5!
- Switch to swc-loader from babel for super fast build times!
- Log build progress (disable with
--no-progress
orprogress: false
in the config - Improve error handling, log unexpected errors when serving bundles in development instead of hanging
- Remove the graceful termination fix introduced in 0.21.1 as it does not appear to work in node@16
- Replace url-loader and file-loader with webpack 5 native asset support
- Upgrade all dependencies
- Breaking: switch to the latest browserslist defaults - this makes both
modern
andlegacy
builds the same by default, but you can still configure each one independently - Breaking: the runtime content is now referenced via
runtime
instead ofassets.runtime
in the template - Breaking: simplified logging behind
--log
flag, choose betweeninfo
,progress
ornone
, with default beinginfo,progress
- Breaking: removed support for react-hot-loader, you can still tweak your config to pull it in, but it is no longer automatically configured, use
react-refresh
instead! - Breaking: remove --jsx command line flag, use config instead
- Add support for optional chaining and nullish coalescing operator. This is supported by babel out of the box, but since jetpack is still on webpack 4 (it's faster?), we need to include the right plugins explicitly for this to work.
- Upgrade all of the non breaking dependencies
- Fix graceful termination in
jetpack/serve
. In case the req is destroyed, make sure to also destroy the upstream proxyReq to the dev server, so that the request does not hold up the server from closing.
- Upgrade all dependencies. Except do not upgrade to webpack 5 just yet and do not upgrade plugins that dropped webpack 4 support.
- Fix proxy feature - proxy the query params correctly (issue #89)
- Upgrade all dependencies, this includes updating to
PostCSS 8
and includes a breaking change to the webpack config generated by jetpack around thepostcss-loader
- Default to
fast-refresh
for React hot reloading ifreact-hot-loader
is not installed in the project
- Install caniuse-lite as a project dependency, to force install the latest version globally in the dependency tree. Previously, a message "Browserslist: caniuse-lite is outdated. Please run next command
npm update
" would show up to jetpack's users.
- Upgrade all dependencies
- Allow removing
core-js
alias to allow for any version ofcore-js
. See #69.
- Add
options.publicPath
- allows to specify where assets will be served from, e.g. a CDN url.
Big improvements! π
- Add support for differential bundling - jetpack can output modern and legacy bundles
- Modern bundles are smaller and less transpiled compared to the previous version
- Ship a complementary package for differential serving - jetpack-serve
- Transpile node_modules ensuring modern packages from npm work as expected
- Add content hashes to output file names to improve long term caching
- Add
-i, --print-config
option to dev and build commands - Upgrade all dependencies
Differential bundling
- By default, jetpack only compiles for modern browsers.
- To see what browsers those are, jetpack provides a new command
jetpack browsers
that prints the browserslist query, list of browsers and coverage. - To opt into legacy browser bundling you should configure a new option
options.target = { modern: true, legacy: true }
. - Or pass
--legacy
,--modern
or both toserve
,build
,inspect
andbrowsers
, e.g.:
$ jetpack --legacy
$ jetpack inspect --legacy
$ jetpack browsers --legacy
$ jetpack browsers --modern
$ jetpack browsers --legacy --modern
- Previously, jetpack would not always correctly transpile async/await. Now, jetpack ships with it's own copy of regenerator, but only uses it in legacy browsers by default. Modern browsers will get no async/await transpilation!
- You can customize what browsers are considered modern and legacy using any of the methods supported by browserslist. Use
modern
andlegacy
environments to configure the browsers for each. Here's an example of.browserslistrc
file:
[modern]
> 10%
[legacy]
> 0.1%
- You can check that the configuration is taken into account by running
jetpack browsers
whenever you tweak your browserslist.
Differential serving
- For production serving, jetpack opted to not use module/no module approach by default due to it's 2 limitations:
- First, at the moment, module/no module option in @babel/preset-env transpiles async/await into regenerator and that's not desired for modern browsers.
- Second, over time, the browsers that support modules will get old, and by using browser detection to serve the right bundle we can keep transpiling less and less in the future.
- By default, if you only produce a modern bundle, the output is backward compatible and can be served the same way as in previous versions of jetpack, e.g. using
express.static
middleware or by uploadingdist
to a CDN. If you produce both modern and legacy bundles, however, you will have to use the built injetpack/serve
module or the new [jetpack-serve(https://github.com/KidkArolis/jetpack-serve) package. Jetpack's serve middleware now detects if the browser is modern or not using the same browserslist queries used in bundling and serves the appropriate html file theindex.html
orindex.legacy.html
as appropriate. See https://github.com/KidkArolis/jetpack-serve for more details on usage.
Print config
- You can now see the config that has been generated for your dev or production builds by running some of the following:
jetpack -i
jetpack --print-config
jetpack --print-config --legacy
jetpack build --print-config
jetpack build --print-config --modern
jetpack build --print-config --legacy
This prints the config using Node's util.inspect
, and since webpack config is a JavaScript data structure that might contain functions, classes, instances and other non easily serializable things, not everyhting might be easily inspectable in this output. This is not meant to be used as copy paste into webpack.config.js
(althought it could be a good starting point), it's mostly meant for debugging any issues and understanding exactly what jetpack is doing in your project.
- Run postcss over sass loader output, this fixes autoprefixing sass
- Upgrade all dependencies
- Fix compiler error handling - catch build errors thoroughly and always exit with status 1 if compilation fails for any reason.
- Fix all security warnings
- Upgrade all dependencies, brings in [email protected], [email protected], [email protected] that have some breaking changes
- Add support for Sass! Simply install
node-sass
orsass
and import '.scss' files. Works with css modules, allows specifyingresources: []
that become available to each scss file. - Fix an issue where jetpack/serve was running command line arg parsing, preventing ability to require apps that import jetpack/serve. This is useful when you try and require your app for debugging and tests.
- Upgrade to core-js@3
- Upgrade all dependencies
- Fix compiler error handling
- Fix compiler error handling
- Upgrade all deps
- Fix how
babel
and@babel/preset-env
detects module types when deciding how to inject polyfills, by usingsourceType: 'unambiguous'
, we ensure that no matter if you use CJS or ESM in your modules, jetpack will bundle them correctly and inject core-js polyfills correctly (most of the time anyway..).
- Upgrade all deps
- Fix
react-hot-loader
webpack plugin config
- Fix reading
title
from config file
- Fix where
react-hot-loader
is loaded from, it should be loaded from the target dir
- Rename the
--no-hot
shorthand from-h
to-r
, to reclaim-h
for help info - Fix
jetpack.config.js#hot
option, it wasn't being read from options since cli arg was always defaulting tofalse
- No longer refresh the page if webpack hot patch is not accepted, for nicer user experience. It's still possible to configure page reloading with manual config override using
jetpack.config.js#webpack
. - Improve hot reloading support.
react-hot-loader
has been removed from jetpack. User's of jetpack now need to installreact-hot-loader
to opt into using it. Webpack config has been updated to work with[email protected]
which supports React Hooks out of the box and improves the overall experience.
To use this you first need to install react-hot-loader
with npm i -D react-hot-loader
and then update the code from:
import { hot } from 'jetpack/react-hot-loader'
const App = () => <div>Hello World!</div>
export default hot(module)(App)
to
import { hot } from 'react-hot-loader/root'
const App = () => <div>Hello World!</div>
export default hot(App)
- Upgrade css-loader to 2.0.0. This upgrades it's dependency on PostCSS to v7, which means there's only one version of PostCSS being used by jetpack, which means faster install times and better performance.
- Fix
jetpack/serve
production mode, serve index.html if requested pathname does not exist in dist
- Remove console.log from the jetpack/serve module
- Fix
jetpack inspect
command - Fix
proxy
to properly handle node's req and res - Fix compatibility
- Fix
react-hot-loader
to work even when jetpack not installed locally - Fix
proxy
to work with non express servers - Only configure
react-hot-loader
if hot reloading is enabled and react is installed
Everything changed. Apologies if it broke your project. See the README and docs to learn about all the new features, command line args and configuration options.