Skip to content

[BUG] - [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file://next-app-template/hero.ts?id=1771297031716 is not specified and it doesn't parse as CommonJS #6238

@Key5n

Description

@Key5n

HeroUI Version

2.8.9

Describe the bug

Rather a work around than a bug report.
I definitely followed the official documentation to set up Hero UI, but I got the following warning after set up Hero UI with Next.js v16 and tailwindcss v4.

(node:17170) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/key5n/dev/heroui-nextjs-app/hero.ts?id=1771298920789 is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/key5n/dev/heroui-nextjs-app/package.json.
(Use `node --trace-warnings ...` to show where the warning was created)

You can eliminate this message with

  1. "type": "module" in `package.json" as the message tells
  2. renaming hero.ts to hero.mts

I prefer hero.mts rather attaching "type": "module".

This warning shows even on a template created with npx heroui-cli init.
I hope this warning would be resolved.

Full Console Logs:

❯ npm run dev

> heroui-nextjs-app@0.1.0 dev
> next dev

▲ Next.js 16.1.6 (Turbopack)
- Local:         http://localhost:3000
- Network:       http://133.68.131.188:3000

✓ Starting...
✓ Ready in 607ms
(node:17170) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/key5n/dev/heroui-nextjs-app/hero.ts?id=1771298920789 is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/key5n/dev/heroui-nextjs-app/package.json.
(Use `node --trace-warnings ...` to show where the warning was created)
 GET / 200 in 1688ms (compile: 1600ms, render: 87ms)

You can reproduce this warning in my repository: https://github.com/Key5n/heroui-nextjs-app

Your Example Website or App

https://github.com/Key5n/heroui-nextjs-app

Steps to Reproduce the Bug or Issue

  1. clone my repo
  2. npm install
  3. npm run dev
  4. The warning shows on console

Expected behavior

No warning shows

Screenshots or Videos

Image

Operating System Version

macOS

Browser

Firefox

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