Rollup Version
4.59.0
Operating System (or Browser)
MacOS 14.6.1
Node Version (if applicable)
20.19.6
Link To Reproduction
https://stackblitz.com/edit/rollup-repro-iaxxfmyq
Expected Behaviour
UMD output should remain valid JavaScript regardless of other output entries.
Mixing umd and cjs outputs should not cause invalid identifier/function declarations in UMD codegen.
Config:
import nodeResolve from '@rollup/plugin-node-resolve';
export default {
input: './src/main.js',
output: [
{
name: 'main',
file: './dist/index.js',
format: 'umd',
},
{
dir: './dist/',
format: 'cjs',
manualChunks: (id) => {
if (/node_modules/.test(id)) {
return 'vender';
}
},
},
],
plugins: [nodeResolve()],
};
Entry:
import { _ as type_of } from '@swc/helpers/esm/_get.js'
console.log(type_of)
Actual Behaviour
UMD output contains invalid syntax (function vender.xxx()) and cannot be parsed/executed.
Build output
// ...
return object;
}
function vender._get(target, property, receiver) {
// ^ Error Here
if (typeof Reflect !== "undefined" && Reflect.get) vender._get = Reflect.get;
else {
// ...
Rollup Version
4.59.0
Operating System (or Browser)
MacOS 14.6.1
Node Version (if applicable)
20.19.6
Link To Reproduction
https://stackblitz.com/edit/rollup-repro-iaxxfmyq
Expected Behaviour
UMD output should remain valid JavaScript regardless of other output entries.
Mixing umd and cjs outputs should not cause invalid identifier/function declarations in UMD codegen.
Config:
Entry:
Actual Behaviour
UMD output contains invalid syntax (function vender.xxx()) and cannot be parsed/executed.
Build output