Skip to content

Error when try to use .mjs babel.config.mjs file #953

Description

@sotiristherobot

I'm submitting a bug report

Webpack Version:
5.74.0

Babel Core Version:
7.19.1

Babel Loader Version:
8.2.5

Please tell us about your environment:
OSX 10.x

Current behavior:
I am converting my project's config from .js to .mjs and I'm getting the following error:
Cannot change caching after evaluation has completed.

Expected/desired behavior:
Expect to be able to just replace .js extension with .mjs and everything to work as before (with changing imports/exports to mjs)

So my babel configuration file is now named babel.config.mjs

export default function(api) {

 // any attempt to use anything here from api fails with the following message:
//  Cannot change caching after evaluation has completed.
 
// return usual things
}

Webpack configuration is pretty standard (.js extension) but the concerning block is like this:

    module: {
      rules: [
        {
          test: /\.tsx?$/,
          exclude: /(node_modules)/,
          use: {
            loader: "babel-loader",
          },
        },
      ],
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions