Skip to content

Two or more css modules import return error Uncaught ReferenceError: __content_placeholder__ is not defined #74

Open
@adityasingh773

Description

@adityasingh773
"esbuild": "^0.20.2",
"esbuild-css-modules-plugin": "^3.1.1"

The plugin works fine when I have a single index.module.css file in my project with setting inject: true

But as soon as I add two or more css modules in my project, my build fails and I get this error:
Uncaught ReferenceError: __content_placeholder__ is not defined

When I look at output js file, I see this:

  // esbuild-css-modules-plugin-ns-js::src/index.module.css:injector.js
  var content2 = __content_placeholder__;
  var digest2 = __digest_placeholder__;

which explains why I get the error. But I am not sure how to fix it.

I have created a public repository with two branches to easily replicate the behaviour.

  1. Working version with just 1 css module file
  2. Version with error when I add 1 more css module file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions