node:internal/modules/esm/assert:89
throw new ERR_IMPORT_ASSERTION_TYPE_MISSING(url, validType);
^
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "/root/node_modules/.pnpm/tailwindcss@3.4.14/node_modules/tailwindcss/package.json" needs an import attribute of type "json"
at validateAttributes (node:internal/modules/esm/assert:89:15)
at defaultLoad (node:internal/modules/esm/load:153:3)
at async ModuleLoader.load (node:internal/modules/esm/loader:553:7)
at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:45) {
code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}
Node.js v20.17.0
Version
Details
I'm using Rslib with Import Attributes.
If the imported JSON has been externalized, the Import Attributes will be removed:
This will give an error since we should use Import Attributes to import JSON in NodeJS ESM.
This is the same when using dynamic import:
Reproduce link
https://github.com/colinaaa-reproductions/rslib-repro-import-attributes
Reproduce Steps
pnpm install
npm run build
node dist/index.js
An error will be thrown: