You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The generation of openapi.json is broken on node v14 and type=module:
$ yarn swagger-jsdoc -d openapi.js -o docs/openapi.json src/**/*.js
Error while loading definition file 'openapi.js':
Must use import to load ES Module: .../openapi.js
require() of ES modules is not supported.
require() of .../openapi.js from .../node_modules/swagger-jsdoc/src/utils.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename openapi.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from ...package.json.
Renaming to openapi.cjs as a workaround is broken nonetheless because swagger-jsdoc is expecting only js/json/yml extensions.
The text was updated successfully, but these errors were encountered:
Hi @damianobarbati I spent an hour looking at sindresorhus/meta#15 and your bug report in order to try solving it. I haven't had the time to solve the issue fully, I tried something really quick and you can have a look and suggest further changes.
The generation of openapi.json is broken on node v14 and
type=module
:Renaming to
openapi.cjs
as a workaround is broken nonetheless because swagger-jsdoc is expecting only js/json/yml extensions.The text was updated successfully, but these errors were encountered: