-
Notifications
You must be signed in to change notification settings - Fork 130
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
feat: upgrade rspack to 0.5 canary #1171
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,8 @@ | |
}, | ||
"dependencies": { | ||
"@rsbuild/shared": "workspace:*", | ||
"@rspack/core": "0.4.5", | ||
"@rspack/core": "0.4.5-canary-be59383-20240105051840", | ||
"@swc/helpers": "0.5.3", | ||
"core-js": "~3.32.2", | ||
"html-webpack-plugin": "npm:[email protected]", | ||
"postcss": "8.4.31" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import type { RsbuildPlugin } from '../../types'; | ||
|
||
import { setConfig, isUsingHMR } from '@rsbuild/shared'; | ||
import { isUsingHMR } from '@rsbuild/shared'; | ||
|
||
export const pluginHMR = (): RsbuildPlugin => ({ | ||
name: 'rsbuild:hmr', | ||
|
||
setup(api) { | ||
api.modifyRspackConfig((rspackConfig, utils) => { | ||
api.modifyBundlerChain((chain, utils) => { | ||
const config = api.getNormalizedConfig(); | ||
|
||
const usingHMR = isUsingHMR(config, utils); | ||
|
||
setConfig(rspackConfig, 'devServer.hot', usingHMR); | ||
if (usingHMR) { | ||
chain | ||
.plugin(utils.CHAIN_ID.PLUGIN.HMR) | ||
.use(utils.bundler.HotModuleReplacementPlugin); | ||
} | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,13 @@ export const pluginSwc = (): RsbuildPlugin => ({ | |
|
||
applyDecorator(swcConfig, config.output.enableLatestDecorators); | ||
|
||
if (swcConfig.jsc?.externalHelpers) { | ||
chain.resolve.alias.set( | ||
'@swc/helpers', | ||
path.dirname(require.resolve('@swc/helpers/package.json')), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @swc/helpers is a peerDependencies of @rspack/core in 0.5, before the alias is added by rspack |
||
); | ||
} | ||
|
||
// apply polyfill | ||
if (isWebTarget(target)) { | ||
const polyfillMode = config.output.polyfill; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = ` | |
}, | ||
}, | ||
"context": "<ROOT>", | ||
"devServer": { | ||
"hot": true, | ||
}, | ||
"devtool": "cheap-module-source-map", | ||
"entry": { | ||
"index": [ | ||
|
@@ -649,9 +646,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = ` | |
RemoveCssSourcemapPlugin { | ||
"name": "RemoveCssSourcemapPlugin", | ||
}, | ||
HotModuleReplacementPlugin { | ||
"name": "HotModuleReplacementPlugin", | ||
}, | ||
], | ||
"resolve": { | ||
"alias": { | ||
"@swc/helpers": "<ROOT>/node_modules/<PNPM_INNER>/@swc/helpers", | ||
"core-js": "<ROOT>/node_modules/<PNPM_INNER>/core-js", | ||
}, | ||
"extensions": [ | ||
|
@@ -682,9 +683,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod | |
}, | ||
}, | ||
"context": "<ROOT>", | ||
"devServer": { | ||
"hot": false, | ||
}, | ||
"devtool": false, | ||
"entry": { | ||
"index": [ | ||
|
@@ -1243,7 +1241,9 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod | |
"_options": { | ||
"compress": "{"passes":1,"pure_funcs":[],"drop_console":false}", | ||
"exclude": undefined, | ||
"extractComments": "true", | ||
"extractComments": { | ||
"condition": "@preserve|@lic|@cc_on|^/**!", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}, | ||
"format": "{"comments":false,"asciiOnly":true}", | ||
"include": undefined, | ||
"mangle": "{"keep_classnames":false,"keep_fnames":false}", | ||
|
@@ -1370,6 +1370,7 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod | |
], | ||
"resolve": { | ||
"alias": { | ||
"@swc/helpers": "<ROOT>/node_modules/<PNPM_INNER>/@swc/helpers", | ||
"core-js": "<ROOT>/node_modules/<PNPM_INNER>/core-js", | ||
}, | ||
"extensions": [ | ||
|
@@ -1400,9 +1401,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe | |
}, | ||
}, | ||
"context": "<ROOT>", | ||
"devServer": { | ||
"hot": false, | ||
}, | ||
"devtool": "cheap-module-source-map", | ||
"entry": { | ||
"index": [ | ||
|
@@ -1786,6 +1784,9 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe | |
}, | ||
], | ||
"resolve": { | ||
"alias": { | ||
"@swc/helpers": "<ROOT>/node_modules/<PNPM_INNER>/@swc/helpers", | ||
}, | ||
"conditionNames": [ | ||
"require", | ||
"node", | ||
|
@@ -1815,9 +1816,6 @@ exports[`tools.rspack > should match snapshot 1`] = ` | |
}, | ||
}, | ||
"context": "<ROOT>", | ||
"devServer": { | ||
"hot": true, | ||
}, | ||
"devtool": "cheap-module-source-map", | ||
"entry": { | ||
"index": [ | ||
|
@@ -2463,9 +2461,13 @@ exports[`tools.rspack > should match snapshot 1`] = ` | |
RemoveCssSourcemapPlugin { | ||
"name": "RemoveCssSourcemapPlugin", | ||
}, | ||
HotModuleReplacementPlugin { | ||
"name": "HotModuleReplacementPlugin", | ||
}, | ||
], | ||
"resolve": { | ||
"alias": { | ||
"@swc/helpers": "<ROOT>/node_modules/<PNPM_INNER>/@swc/helpers", | ||
"core-js": "<ROOT>/node_modules/<PNPM_INNER>/core-js", | ||
}, | ||
"extensions": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
devServer is remove from core, now dev-server need to apply HotModuleReplacementPlugin manually
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.
get 👌