Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

CJS shorthand does not enable all CJS options #149

Closed
tilgovi opened this issue Nov 13, 2017 · 2 comments
Closed

CJS shorthand does not enable all CJS options #149

tilgovi opened this issue Nov 13, 2017 · 2 comments
Labels

Comments

@tilgovi
Copy link
Contributor

tilgovi commented Nov 13, 2017

The documentation says that { @std/esm: "cjs" } is a shorthand for{ "@std/esm": { "esm": "js", "cjs": true }} but these result in different behavior.

Given the following file:

import { lstat } from 'fs';

Running node -r @std/esm on it results in an error with the shorthand but not with the long version:

SyntaxError: Module 'fs' does not provide an export named 'lstat'

Perhaps the first if condition at https://github.com/standard-things/esm/blob/master/src/pkg-info.js#L160 should call createCJS(true) and set cjsOptions?

@jdalton
Copy link
Member

jdalton commented Nov 13, 2017

Ah, thank you!

@jdalton jdalton added the bug label Nov 13, 2017
@tilgovi
Copy link
Contributor Author

tilgovi commented Nov 14, 2017

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants