Skip to content

v.4.0.0 ESM err on Windows 11 #237

@Krutsch

Description

@Krutsch

Node.js version 17.9.0

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at new NodeError (node:internal/errors:372:5)
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1075:11)
    at defaultResolve (node:internal/modules/esm/resolve:1155:3)
    at ESMLoader.resolve (node:internal/modules/esm/loader:604:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)
    at ESMLoader.import (node:internal/modules/esm/loader:404:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1037:29)
    at importModuleDynamicallyWrapper (node:internal/vm/module:437:21)
    at importModuleDynamically (node:vm:381:46)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Code to reproduce:
type module in package.json.
postcss.config.cjs:

const isProduction = process.env.NODE_ENV === "production";
const tailwindcss = require("./tailwind.config.cjs");

module.exports = {
  plugins: {
    tailwindcss,
    ...(isProduction
      ? {
          cssnano: {
            preset: "advanced",
          },
        }
      : {}),
  },
};

let { plugins, options, file: postcssFile } = await postcssrc({});

This did not error in the verion before

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