Skip to content

Can not export the name-imported with default in transpiled cjs  #3029

Closed
@snowyu

Description

The ESM js files to transpile:

// fn.js
export function fn() {}
export default fn
// fn1.js
export function fn1() {}
export default fn1
// index.js
export * from './fn'
export * from './fn1'
// package.json
{
  "name": "util-ex",
  "main": "./lib/index.js",
  "module": "./src/index.js",
  "type": "commonjs",
}

Used it in another esm package after transpiled, found no cloneObject exported. exported only after commenting the export default cloneObject

import { fn } from 'util-ex'
console.log(fn) // is undefined

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions