Skip to content

postcss-loader dependency does not support ESM #613

Closed
@GamzeeRakoon

Description

@GamzeeRakoon

Bug report

while compiling css with postcss-loader it uses the dependency cosmiconfig but this does not support ESM type
and will give the error

Error [ERR_REQUIRE_ESM]: require() of ES Module ~\_frontend\postcss.config.js from ~\_frontend\node_modules\postcss-loader\node_modules\cosmiconfig\dist\loaders.js not supported.

Actual Behavior

when postcss loader uses cosmiconfig it uses non esm compatible code and gives an error and fails to compile the css

Expected Behavior

postcss loader should compile the css while being ESM compatible

How Do We Reproduce?

heres my testing repository:
https://github.com/LithRakoon/npm
npm i
npm run build
see error

Please paste the results of npx webpack info here, and mention other relevant information

  System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
    Memory: 5.70 GB / 15.89 GB
  Binaries:
    Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
    npm: 9.1.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.819.0), Chromium (107.0.1418.56)
    Internet Explorer: 11.0.22621.1
  Packages:
    babel-loader: ^8.1.0 => 8.3.0
    css-loader: ^6.7.2 => 6.7.2
    postcss-loader: ^7.0.1 => 7.0.1
    sass-loader: ^13.2.0 => 13.2.0
    style-loader: ^0.23.1 => 0.23.1
    webpack: ^5.75.0 => 5.75.0
    webpack-cli: ^5.0.0 => 5.0.0
    webpack-dev-server: ^3.10.3 => 3.11.3

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