Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in 10.0.1: copySync is nolonger accessible in ESM mode #943

Closed
akphi opened this issue Feb 24, 2022 · 2 comments
Closed

Regression in 10.0.1: copySync is nolonger accessible in ESM mode #943

akphi opened this issue Feb 24, 2022 · 2 comments

Comments

@akphi
Copy link

akphi commented Feb 24, 2022

I think the change in #922 broke the importing of copySync in ESM mode a bit. The error is below

import { mkdirs, copySync } from 'fs-extra';
                 ^^^^^^^^
SyntaxError: Named export 'copySync' not found. The requested module 'fs-extra' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'fs-extra';
const { mkdirs, copySync } = pkg;

This did not happen in 10.0.0.

  • Operating System: macOS 11.6.4
  • Node.js version: 16.8.0
  • fs-extra version: 10.0.1
@akphi
Copy link
Author

akphi commented Feb 25, 2022

@RyanZim Reading #746 and it seems like I was lucky to be able to use fs-extra in this ESM-like fashion so far... Let me know what you think, I'm happy to close this if you confirm this is totally by accident and we should avoid using this ESM-like approach till #746 is resolved. Thanks!

@RyanZim
Copy link
Collaborator

RyanZim commented Feb 25, 2022

Yeah, we've never supported ESM; I surprised that ever worked.

@RyanZim RyanZim closed this as completed Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants