Skip to content

Using type module breaks preset-env polyfills #1337

@m10

Description

@m10

When using Webpack Encore in a project with "type": "module" in package.json the resulting bundle file contains require calls which include the polyfills through @babel/preset-env. These should have been replaced by wepack with the file contents. This problem does not occur when using a simple plain webpack config.

Removing "type": "module" (and rewriting the config as commonjs) the issue is not present.

Reproduction repository: https://github.com/m10/encore-type-module
Also see branch "commonjs" for a working version without type module: https://github.com/m10/encore-type-module/tree/commonjs
and the branch "webpack" for a working version with type module but without encore, using a simple webpack config instead: https://github.com/m10/encore-type-module/tree/webpack

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions