Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dull-jokes-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/react-rsbuild-plugin": patch
---

fix(rspeedy/plugin-react): mkdir main:background fails in windows
11 changes: 6 additions & 5 deletions packages/rspeedy/plugin-react/src/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,19 @@ export function applyEntry(
: config.output?.filename
) ?? '[name].[platform].bundle'

// We do not use `${entryName}__background` since the default CSS name is `[name]/[name].css`.
// We would like to avoid adding `__background` to the output CSS filename.
const mainThreadEntry = `${entryName}__main-thread`

const mainThreadName = path.join(
isLynx
// TODO: config intermediate
? DEFAULT_DIST_PATH_INTERMEDIATE
// For non-Lynx environment, the entry is not deleted.
// So we do not put it in the intermediate.
: '',
`${entryName}/main-thread.js`,
`${mainThreadEntry}/main-thread.js`,
)
// We do not use `${entryName}:main-thread` since the default CSS name is `[name]/[name].css`.
// We would like to avoid adding `:main-thread` to the output CSS filename.
const mainThreadEntry = entryName

const backgroundName = path.join(
isLynx
Expand All @@ -100,7 +101,7 @@ export function applyEntry(
: '',
getBackgroundFilename(entryName, environment.config, isProd),
)
const backgroundEntry = `${entryName}:background`
const backgroundEntry = entryName

mainThreadChunks.push(mainThreadName)

Expand Down
2 changes: 1 addition & 1 deletion packages/rspeedy/plugin-react/src/splitChunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const applySplitChunksRule = (
rspackConfig.optimization.splitChunks.chunks = function chunks(chunk) {
// TODO: support `splitChunks.chunks: 'async'`
// We don't want main thread to be splitted
return Boolean(chunk.name?.includes(':background'))
return !chunk.name?.includes('__main-thread')
}
return rspackConfig
})
Expand Down
Loading
Loading