-
Notifications
You must be signed in to change notification settings - Fork 700
Labels
Description
Reproduction link or steps
index.ts
/*!
* INDEX.TS (ABOVE IMPORT)
* THIS COMMENT IS NOT PRESERVED
*/
import { foo } from './foo.ts';
/*!
* INDEX.TS (ABOVE IMPORT)
* THIS COMMENT IS NOT PRESERVED
*/
import { bar } from './bar.ts';
/*!
* INDEX.TS (BELOW IMPORT)
*/
/*!
* INDEX.TS (ABOVE EXPORT)
*/
export default foo + bar;
/*!
* INDEX.TS (BELOW EXPORT)
*/rolldown.config.ts
import type { RolldownOptions } from 'rolldown';
const config: RolldownOptions = {
experimental : {
attachDebugInfo: 'none'
},
output: {
legalComments: 'inline',
format: 'esm'
}
}
export default configWhat is expected?
The legal comments above import statements should be preserved
index.js
/*!
* INDEX.TS (ABOVE IMPORT)
* THIS COMMENT IS NOT PRESERVED
*/
/*!
* FOO.TS (ABOVE EXPORT)
*/
const foo = "foo";
/*!
* FOO.TS (BELOW EXPORT)
*/
/*!
* INDEX.TS (ABOVE IMPORT)
* THIS COMMENT IS NOT PRESERVED
*/
/*!
* FOO.TS (ABOVE EXPORT)
*/
const bar = "bar";
/*!
* FOO.TS (BELOW EXPORT)
*/
/*!
* INDEX.TS (BELOW IMPORT)
*/
/*!
* INDEX.TS (ABOVE EXPORT)
*/
var index_default = foo + bar;
/*!
* INDEX.TS (BELOW EXPORT)
*/
export { index_default as default };What is actually happening?
The legal comments above import statements (which are very common as license file header) is not preserved with the options legalComments: 'inline'
index.js
/*!
* FOO.TS (ABOVE EXPORT)
*/
const foo = "foo";
/*!
* FOO.TS (BELOW EXPORT)
*/
/*!
* FOO.TS (ABOVE EXPORT)
*/
const bar = "bar";
/*!
* FOO.TS (BELOW EXPORT)
*/
/*!
* INDEX.TS (BELOW IMPORT)
*/
/*!
* INDEX.TS (ABOVE EXPORT)
*/
var index_default = foo + bar;
/*!
* INDEX.TS (BELOW EXPORT)
*/
export { index_default as default };System Info
System:
OS: Linux 6.15 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz
Memory: 4.85 GB / 15.07 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 24.4.1 - /usr/bin/node
npm: 11.4.2 - /usr/bin/npm
pnpm: 10.13.1 - /usr/bin/pnpm
bun: 1.2.18 - ~/.bun/bin/bun
npmPackages:
rolldown: 1.0.0-beta.29 => 1.0.0-beta.29Any additional comments?
I found the bug while trying to preserve license information on the final bundled file.
Reactions are currently unavailable