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

Babel transpilation error #534

Closed
Pyroarsonist opened this issue Mar 9, 2022 · 1 comment
Closed

Babel transpilation error #534

Pyroarsonist opened this issue Mar 9, 2022 · 1 comment

Comments

@Pyroarsonist
Copy link

Importing fileTypeFromBuffer using babel transpiler with Node v16.13.1 throws an error, am I doing something wrong? (I also tried using dynamic import and give the same error)

Error message: Instead change the require of index.js in $FILE_PATH to a dynamic import() which is available in all CommonJS modules

file-type version: 17.1.1

babel deps:

 "@babel/cli": "^7.14.8",
 "@babel/core": "^7.15.0",
 "@babel/eslint-parser": "^7.15.0",
 "@babel/eslint-plugin": "^7.14.5",
 "@babel/node": "^7.14.9",
 "@babel/plugin-transform-modules-commonjs": "^7.15.4",
 "@babel/preset-env": "^7.15.0",

babel.rc:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "current"
        }
      }
    ]
  ],
  "plugins": [
    [
      "@babel/plugin-transform-modules-commonjs",
      {
        "allowTopLevelThis": true,
        "loose": true,
        "lazy": true
      }
    ]
  ]
}

file-type v16.5.3 works without issues

@Borewit
Copy link
Collaborator

Borewit commented Mar 9, 2022

Same as #525

@Borewit Borewit closed this as completed Mar 9, 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