-
Notifications
You must be signed in to change notification settings - Fork 87
WebpackからRspackへの移行 #581
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
WebpackからRspackへの移行 #581
Conversation
- WebpackをRspackに置き換え - package.jsonにcleanスクリプトを追加(packages/*/dist, packages/*/libを削除) - package.jsonにbuild:nocacheスクリプトを追加(キャッシュなしでビルド) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
パッケージのクリーンアップ処理を削除し、ビルドキャッシュのみを無効化するように変更。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| parser: { | ||
| syntax: 'typescript', | ||
| }, | ||
| target: 'es2020', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node20とか指定すると
6 │ "target": "node20",
· ▲
· ╰── Unknown ES version: node20 at line 6 column 22
とエラーになるのでESを指定する必要がある
cm-wada-yusuke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1点質問しました
| { | ||
| test: /\.node$/, | ||
| loader: 'node-loader', | ||
| type: 'asset/resource', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[q] ここは変更する必要ありました?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以下はwebpack側の資料ですが、 node-loaderは現状は非推奨で、asset/resourceに移行すべきのようでした
https://github.com/webpack-contrib/node-loader
https://github.com/webpack/webpack/tree/main/examples/nodejs-addons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
資料ありがとうございます!承知しました!
cm-wada-yusuke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMです!
📑 Summary
仕様の変更
ビルドツールをWebpackからRspackに変更。
pnpm -C packages/zenn-cli build:server 12.43s user 2.20s system 153% cpu 9.520 totalを実行して検証。webpack(before):
rspack(after):
(9.87 ÷ 12.43) × 100 = 79.4%の高速化
元の時間の 20.6% に短縮
約 4.9倍 の速度向上
コードの変更
packages/zenn-cli/webpack.server.jsを削除し、packages/zenn-cli/rspack.server.jsに置き換えpackage.jsonに以下のスクリプトを追加:clean: ビルド成果物(packages/*/dist,packages/*/lib)を削除build:nocache: キャッシュなしでビルドを実行packages/zenn-cli/package.jsonの依存関係を更新:webpack関連パッケージを削除@rspack/core,@rspack/cliを追加その他・備考
📋 Tasks
プルリクエストを作成いただく際、お手数ですが以下の内容についてご確認をお願いします。
canaryブランチに対するプルリクエストであるより詳しい内容は Pull Request Policy を参照してください。