Skip to content

Doesn't export /safe in package.json #350

@movahhedi

Description

@movahhedi

The package.json file doesn't provide the following props (the values are for example):

{
  "source": "src/index.js",             // input
  "main": "dist/foo.js",                // CommonJS output bundle
  "umd:main": "dist/foo.umd.js",        // UMD output bundle
  "module": "dist/foo.mjs",             // ES Modules output bundle
  "exports": {
    "types": "./dist/foo.d.ts",         // TypeScript typings for NodeNext modules
    "require": "./dist/foo.js",         // CommonJS output bundle
    "default": "./dist/foo.modern.mjs", // Modern ES Modules output bundle
  },
  "types": "dist/foo.d.ts"              // TypeScript typings
}

And more importantly, doesn't do so for /safe. so importing it like import Colors from "colors/safe"; produces an error in some node configured environments. you'd have to import it like import Colors from "colors/safe.js";.

Didn't have the time to make a tested PR, just noted it for it in case, as a technical debt.

Example is from microbundle's README.

Metadata

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