-
Notifications
You must be signed in to change notification settings - Fork 63
Closed
Description
package.json
{
"type": "module",
"devDependencies": {
"openapi3-ts": "^4.1.1"
}
}
app.mjs
import x from 'openapi3-ts/oas31';
const builder = new x.OpenApiBuilder();
console.log(builder.rootDoc);
it fails to import when running node app.mjs
(node:59840) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
.pnpm/[email protected]/node_modules/openapi3-ts/dist/mjs/oas31.js:1
export * from './dsl/openapi-builder31';
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1195:20)
at Module._compile (node:internal/modules/cjs/loader:1239:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:165:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
Node.js v19.9.0
It's probably because the published package.json does not have "type": "module"
, or that the published files does not end with ".mjs"
koooge
Metadata
Metadata
Assignees
Labels
No labels