-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP => feat(compiler): Migrate from Webpack to RSPack #14925
base: main
Are you sure you want to change the base?
Conversation
rspack-manifest-pluginAuthor: Dane Thurber Description: A Rspack Plugin for generating Asset Manifests Homepage: https://github.com/rspack-contrib/rspack-manifest-plugin
|
Created | over 2 years ago |
Last Updated | 22 days ago |
License | Apache-2.0 |
Maintainers | 2 |
Releases | 149 |
Direct Dependencies | @swc/counter |
README
@swc/plugin-styled-components
Setup
npm install --save-dev @swc/plugin-styled-components @swc/core
Then update your .swcrc
file like below:
{
"jsc": {
"experimental": {
"plugins": [
[
"@swc/plugin-styled-components",
{
"displayName": true,
"ssr": true
}
]
]
}
}
}
${CHANGELOG}
@swc/plugin-relay
Author: 강동윤
Description: SWC plugin for relay
Homepage: https://swc.rs
Created | over 2 years ago |
Last Updated | 14 days ago |
License | Apache-2.0 |
Maintainers | 2 |
Releases | 148 |
Direct Dependencies | @swc/counter |
README
@swc/plugin-relay
Setup
npm install --save-dev @swc/plugin-relay @swc/core
Example
The below shows how to configure @swc/plugin-relay
and pass the options to Webpack:
Create an .swcrc.js
file like the below:
// .swcrc.js
module.exports = {
jsc: {
experimental: {
plugins: [
[
"@swc/plugin-relay",
{
rootDir: __dirname,
artifactDirectory: "src/__generated__",
language: "typescript",
eagerEsModules: true,
},
],
// Or if you want to use multiple projects
[
"@swc/plugin-relay",
{
projects: [
{
rootDir: path.resolve(__dirname, '../project1'),
},
{
rootDir: path.resolve(__dirname, '../project2'),
}
],
language: "typescript",
eagerEsModules: true,
},
],
],
},
parser: {
syntax: "typescript",
tsx: true,
},
transform: {
react: {
runtime: "automatic",
},
},
},
};
And then update your swc-loader
Webpack config:
const swcConfig = require("./.swcrc.js")
// ...
{
include: path.resolve("./src"),
test: /\.ts$/,
use: [
{
loader: "swc-loader",
options: swcConfig,
},
],
}
Note: We're using a
.swcrc.js
file extension up above and importing the config directly because Relay needs access to__dirname
, which can't be derived from the default JSON parsed from.swcrc
.
Output import paths
By default, @swc/plugin-relay
will transpile import paths based on the language
option.
You can use outputFileExtension
to change the file extension of the generated import paths.
plugins: [
[
"@swc/plugin-relay",
{
rootDir: __dirname,
artifactDirectory: "src/__generated__",
language: "typescript",
eagerEsModules: true,
outputFileExtension: "js",
},
],
],
In this example typescript graphql files will output transpiled import path of javascript
ending with .js
.
${CHANGELOG}
@rspack/plugin-react-refresh
Author: Unknown
Description: React refresh plugin for rspack
Homepage: https://github.com/rspack-contrib/rspack-plugin-react-refresh#readme
Created | about 1 year ago |
Last Updated | 2 months ago |
License | MIT |
Maintainers | 3 |
Releases | 557 |
Direct Dependencies | html-entities and error-stack-parser |
@rspack/core
Author: Unknown
Description: The fast Rust-based web bundler with webpack-compatible API
Homepage: https://rspack.dev
Created | over 2 years ago |
Last Updated | 2 days ago |
License | MIT |
Maintainers | 3 |
Releases | 1100 |
Direct Dependencies | @module-federation/runtime-tools , @rspack/lite-tapable , caniuse-lite and @rspack/binding |
README
@rspack/core
The fast Rust-based web bundler with webpack-compatible API.
Documentation
See https://rspack.dev for details.
License
Rspack is MIT licensed.
@rspack/cli
Author: Unknown
Description: CLI for rspack
Homepage: https://rspack.dev
Created | about 2 years ago |
Last Updated | 2 days ago |
License | MIT |
Maintainers | 3 |
Releases | 1085 |
Direct Dependencies | @discoveryjs/json-ext , @rspack/dev-server , colorette , exit-hook , interpret , rechoir , semver , webpack-bundle-analyzer and yargs |
README
@rspack/cli
Command-line interface for rspack.
Documentation
See https://rspack.dev for details.
License
Rspack is MIT licensed.
New dependencies added: @rspack/cli
, @rspack/core
, @rspack/plugin-react-refresh
, @swc/plugin-relay
, @swc/plugin-styled-components
and rspack-manifest-plugin
.
#1086 Bundle Size — 10.54MiB (+10.47%).50f270b(current) vs ffe4f84 main#484(baseline) Important Bundle introduced 8 and removed 9 duplicate packages – View changed duplicate packages Warning Bundle introduced 13 new packages: web-vitals, @sentry-internal/browser-utils, stylis and 10 more – View changed packages Bundle metrics
|
Current #1086 |
Baseline #484 |
|
---|---|---|
Initial JS | 3.81MiB (-3.59% ) |
3.95MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 100% |
2.04% |
Chunks | 240 (+67.83% ) |
143 |
Assets | 244 (+67.12% ) |
146 |
Modules | 5447 (-3.37% ) |
5637 |
Duplicate Modules | 375 (-17.58% ) |
455 |
Duplicate Code | 4.85% (-17.52% ) |
5.88% |
Packages | 276 (-5.15% ) |
291 |
Duplicate Packages | 41 (-2.38% ) |
42 |
Bundle size by type 2 changes
2 regressions
Current #1086 |
Baseline #484 |
|
---|---|---|
JS | 10.06MiB (+7.99% ) |
9.31MiB |
Other | 499.13KiB (+109.86% ) |
237.84KiB |
Bundle analysis report Branch damassi/feat/add-rspack Project dashboard
Generated by RelativeCI Documentation Report issue
The type of this PR is: Feat
Description
This migrates our compiler from Webpack to RSPack, a webpack-compatable bundler written in Rust for nearly instant cache-free compiles and hotreloading. This should speed up prod deploys considerably while also bringing instant DX.
rspack.mp4
Cold boot dev compile times:
Old:
57.31s.
New:
2.42s
Prod compile times:
Old:
57s
New:
8.60s