opticdev / optic

OpenAPI linting, diffing and testing. Optic helps prevent breaking changes, publish accurate documentation and improve the design of your APIs.
https://useoptic.com
MIT License
1.36k stars 83 forks source link

SyntaxError: Unexpected token 'export' from @stoplight/spectral-core #2850

Open 0thernet opened 3 months ago

0thernet commented 3 months ago

Describe the bug Our CI builds started failing because optic run starting throwing a SyntaxError, seems like due to this issue: https://github.com/stoplightio/spectral/issues/2656

To Reproduce Steps to reproduce the behavior:

  1. optic run
  2. see this error
/Users/benguo/.nvm/versions/node/v18.18.2/lib/node_modules/@useoptic/optic/node_modules/@stoplight/json/index.js:1
export * from './bundle';
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/Users/benguo/.nvm/versions/node/v18.18.2/lib/node_modules/@useoptic/optic/node_modules/@stoplight/spectral-core/dist/spectral.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Node.js v18.18.2

Expected behavior Just started seeing this error in CI on our end with no changes. Seems to be this issue, and spectral/stoplight needs to be pinned within Optic. https://github.com/stoplightio/spectral/issues/2656