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
1 change: 0 additions & 1 deletion docs/guide/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ The following options are deprecated and will be removed in the future:
These breaking changes are expected to only affect a minority of use cases:

- **[TODO: this will be fixed before stable release]** https://github.com/rolldown/rolldown/issues/5726 (affects nuxt, qwik)
- **[TODO: this will be fixed before stable release]** Legacy chunks are emitted as an asset file instead of a chunk file due to the lack of prebuilt chunk emit feature ([rolldown#4304](https://github.com/rolldown/rolldown/issues/4034)). This means the chunk related options does not apply to legacy chunks and the manifest file will not include legacy chunks as a chunk file.
- **[TODO: this will be fixed before stable release]** `@vite-ignore` comment edge case ([rolldown-vite#426](https://github.com/vitejs/rolldown-vite/issues/426))
- [Extglobs](https://github.com/micromatch/picomatch/blob/master/README.md#extglobs) are not supported yet ([rolldown-vite#365](https://github.com/vitejs/rolldown-vite/issues/365))
- `define` does not share reference for objects: When you pass an object as a value to `define`, each variable will have a separate copy of the object. See [Oxc Transformer document](https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define) for more details.
Expand Down
11 changes: 9 additions & 2 deletions packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,16 @@ async function buildPolyfillChunk(

// add the chunk to the bundle
ctx.emitFile({
type: 'asset',
type: 'prebuilt-chunk',
name: polyfillChunk.name,
fileName: polyfillChunk.fileName,
source: polyfillChunk.code,
code: polyfillChunk.code,
facadeModuleId: polyfillChunk.facadeModuleId ?? undefined,
isEntry: polyfillChunk.isEntry,
isDynamicEntry: polyfillChunk.isDynamicEntry,
exports: [],
map: polyfillChunk.map ?? undefined,
sourcemapFileName: polyfillChunk.sourcemapFileName ?? undefined,
})
if (polyfillChunk.sourcemapFileName) {
const polyfillChunkMapAsset = _polyfillChunk.output.find(
Expand Down
18 changes: 8 additions & 10 deletions playground/legacy/__tests__/legacy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ describe.runIf(isBuild)('build', () => {
test('should generate correct manifest', async () => {
const manifest = readManifest()
// legacy polyfill
// FIXME: needs https://github.com/rolldown/rolldown/issues/4034
// expect(manifest['../../vite/legacy-polyfills-legacy']).toBeDefined()
// expect(manifest['../../vite/legacy-polyfills-legacy'].src).toBe(
// '../../vite/legacy-polyfills-legacy',
// )
expect(manifest['../../vite/legacy-polyfills-legacy']).toBeDefined()
expect(manifest['../../vite/legacy-polyfills-legacy'].src).toBe(
'../../vite/legacy-polyfills-legacy',
)
expect(manifest['custom0-legacy.js'].file).toMatch(
/chunk-X-legacy\.[-\w]{8}.js/,
)
Expand All @@ -101,11 +100,10 @@ describe.runIf(isBuild)('build', () => {
/chunk-X-legacy[-\w]{8}.js/,
)
// modern polyfill
// FIXME: needs https://github.com/rolldown/rolldown/issues/4034
// expect(manifest['../../vite/legacy-polyfills']).toBeDefined()
// expect(manifest['../../vite/legacy-polyfills'].src).toBe(
// '../../vite/legacy-polyfills',
// )
expect(manifest['../../vite/legacy-polyfills']).toBeDefined()
expect(manifest['../../vite/legacy-polyfills'].src).toBe(
'../../vite/legacy-polyfills',
)
})

test('should minify legacy chunks with terser', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test.runIf(isBuild)('rebuilds styles only entry on change', async () => {
)
expect(findAssetFile(/polyfills-legacy-.+\.js/, 'watch')).toBeTruthy()
const numberOfManifestEntries = Object.keys(readManifest('watch')).length
expect(numberOfManifestEntries).toBe(2) // FIXME: needs https://github.com/rolldown/rolldown/issues/4034
expect(numberOfManifestEntries).toBe(3)

editFile('style-only-entry.css', (originalContents) =>
originalContents.replace('#ff69b4', '#ffb6c1'),
Expand Down