Skip to content

Import error after updating to v5.1.2 #3833

@vpmedia

Description

@vpmedia

Describe the bug

Up until now I've used the webpack.config.babel.js naming convention to use ES6 in my webpack configuration file.
After updating to v5.1.2 I'm getting the following import error:

[webpack-cli] Failed to load '/..../webpack.config.babel.js' config
[webpack-cli] /..../webpack.config.babel.js:9
import { resolve } from 'path';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1175:20)
    at Module._compile (node:internal/modules/cjs/loader:1219:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)
    at WebpackCLI.tryRequireThenImport (/..../node_modules/webpack-cli/lib/webpack-cli.js:223:30)
    at loadConfigByPath (/..../node_modules/webpack-cli/lib/webpack-cli.js:1406:38)

Any tips about migrating? I've not found any code migration related comment regarding this in the release notes. Also if there were some braking changes I would expect to bump the major version.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions