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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot find package '@babel/plugin-preset-env' imported #16434

Closed
1 task
msidolphin opened this issue Apr 16, 2024 · 3 comments
Closed
1 task

[Bug]: Cannot find package '@babel/plugin-preset-env' imported #16434

msidolphin opened this issue Apr 16, 2024 · 3 comments

Comments

@msidolphin
Copy link

msidolphin commented Apr 16, 2024

馃捇

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

{
  test: /\.tsx?$/,
  exclude: /node_modules/,
  use: [
  {
    loader: "babel-loader",
    options: {
      plugins: [
        ["@babel/plugin-transform-runtime", {
          "corejs": 3
        }],
        [
          "@babel/preset-env"
        ]
      ]
    }
  },

Configuration file name

No response

Configuration

{
    plugins: [
      ["@babel/plugin-transform-runtime", {
        "corejs": 3
      }],
      [
        "@babel/preset-env"
      ]
    ]
  }

Current and expected behavior

Why do I configure @babel/preset-env but keep getting a message that the '@babel/plugin-preset-env' package imported from xxx/build/babel-virtual-resolve-base.js cannot be found?

Environment

System:
OS: macOS Mojave 10.14.6
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.10 - ~/.npm-global/bin/yarn
npm: 10.4.0 - ~/.npm-global/bin/npm
pnpm: 8.8.0 - ~/.npm-global/bin/pnpm
npmPackages:
@babel/core: ^7.24.4 => 7.24.4
@babel/plugin-transform-runtime: ^7.24.3 => 7.24.3
@babel/preset-env: ^7.24.4 => 7.24.4
@babel/runtime-corejs3: ^7.24.4 => 7.24.4
babel-loader: ^9.1.3 => 9.1.3

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @msidolphin! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@msidolphin
Copy link
Author

image image

It looks like the babel-loader automatically adds the plugin keyword

@nicolo-ribaudo
Copy link
Member

You should move it to the presets array :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants