Skip to content

[Bug]: Bundling @babel/standalone by webpack emits warnings #14301

@joshuahhh

Description

@joshuahhh

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

import '@babel/standalone';

Configuration file name

No response

Configuration

N/A

Current and expected behavior

Current behavior: When bundling a project with Webpack which includes code that imports '@babel/standalone', Webpack reports:

WARNING in ./node_modules/@babel/standalone/babel.js 308:11-32
Critical dependency: the request of a dependency is an expression
@ ./src/index.js 9:0-27

WARNING in ./node_modules/@babel/standalone/babel.js 346:11-24
Critical dependency: the request of a dependency is an expression
@ ./src/index.js 9:0-27

I think this is due to commonjsRequire's use of require(path).

Environment

Tested in a fresh create-react-app environment, as well as a more minimal Webpack environment.

Possible solution

Given that @babel/standalone is intended for use in a browser environment, I wonder why it includes bare require() calls. Perhaps these parts could be excluded from this build?

Additional context

Please let me know if there's anything else I can do to help. Thanks a bunch!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: upstreamoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: standalone

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions