package.json is misconfigured regarding esm/cjs exports, resulting in the .esm.js file being loaded as a commonjs module and failing in nodejs environment.
import this module in a server-side rendering environment results in the following error:
/.../node_modules/@primer/octicons-react/dist/index.esm.js:1
import React from 'react';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Expected behavior
package.json should either:
have a "type": "commonjs" attribute and export the ES module as .mjs
have a "type": "module" attribute and export the commonjs as .cjs
Describe the bug
package.json
is misconfigured regardingesm/cjs
exports, resulting in the.esm.js
file being loaded as a commonjs module and failing in nodejs environment.https://publint.dev/@primer/octicons-react@19.8.0
Steps to reproduce
import this module in a server-side rendering environment results in the following error:
Expected behavior
package.json
should either:"type": "commonjs"
attribute and export the ES module as.mjs
"type": "module"
attribute and export the commonjs as.cjs