Skip to content

CJS output contains a reference to non-existent variable when exporting default and reexporting everything with interop: compat/auto #5465

@Andarist

Description

@Andarist

Rollup Version

4.14.1

Operating System (or Browser)

Mac

Node Version (if applicable)

No response

Link To Reproduction

https://rollupjs.org/repl/?version=4.14.1&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMColMjBmcm9tJTIwJyU0MHJlZHV4LXNhZ2ElMkZjb3JlJyU1Q25pbXBvcnQlMjBjcmVhdGVTYWdhTWlkZGxld2FyZSUyMGZyb20lMjAnJTQwcmVkdXgtc2FnYSUyRmNvcmUnJTVDbmV4cG9ydCUyMGRlZmF1bHQlMjBjcmVhdGVTYWdhTWlkZGxld2FyZSU1Q24lMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSUyQyUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMm91dHB1dCUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmNqcyUyMiUyQyUyMmludGVyb3AlMjIlM0ElMjJjb21wYXQlMjIlN0QlN0QlN0Q=

Expected Behaviour

Input

export * from '@redux-saga/core'
import createSagaMiddleware from '@redux-saga/core'
export default createSagaMiddleware

Expected output

Output with createSagaMiddleware__namespace declared.

Actual Behaviour

Output

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var createSagaMiddleware = require('@redux-saga/core');



Object.defineProperty(exports, "default", {
	enumerable: true,
	get: function () { return createSagaMiddleware__namespace.default; } 
});
Object.keys(createSagaMiddleware).forEach(function (k) {
	if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
		enumerable: true,
		get: function () { return createSagaMiddleware[k]; }
	});
});

Notice the reference to createSagaMiddleware__namespace which was not created.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions