Skip to content

If tsconfig.json is set to CommonJS mode, the declaration files cannot be read. #1303

Closed
@yuheiy

Description

@yuheiy

Reproduction link

No response

Bug description

If tsconfig.json is set to CommonJS mode, the declaration files for almost modules cannot be read.

tsconfig.json:

{
  "compilerOptions": {
    "module": "CommonJS",
    "moduleResolution": "Node10",
    "strict": true
  }
}

test.ts:

スクリーンショット 2024-02-26 22 52 13

The cause is probably that the types is not set in package.json.

	"main": "dist/index.cjs",
	"module": "dist/index.mjs",
+	"types": "dist/index.d.ts",
	"exports": {
		".": {
			"import": {
				"types": "./dist/index.d.ts",
				"default": "./dist/index.mjs"
			},
			"require": {
				"default": "./dist/index.cjs"
			}
		}
	},

Actual Behavior

No response

Expected Behavior

No response

Can you reproduce it with npx @csstools/csstools-cli <plugin-name> minimal-example.css?

None

npx Output

No response

Extra config

No response

What plugin are you experiencing this issue on?

No response

Plugin version

What OS are you experiencing this on?

No response

Node Version

20

Validations

  • Follow our Code of Conduct
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this bug?

  • I'm willing to open a PR

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