Closed tedyu closed 2 months ago
@mcollina
This change is semantically equivalent.
It will allow downstream projects to avoid Invalid or unexpected token
error.
Our services depend on sonic-boom
via pino
.
Recently I downgraded pino
release in our service due to the Invalid or unexpected token
error mentioned in the description.
How can the error be reproduced? We need that reproduction in our test suite. Otherwise, this is supported syntax on all of the Node.js versions we target.
Looking at the build error:
/opt/app/node_modules/sonic-boom/index.js:393
cb?.()
^
SyntaxError: Invalid or unexpected token
at Object.replacementCompile (/opt/app/node_modules/append-transform/index.js:60:13)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at /opt/app/node_modules/append-transform/index.js:64:4
It seems append-transform
doesn't accept optional chaining.
@jsumners @mcollina Have you seen any user reporting similar issue ?
Thanks
What is append-transform
?
According to https://www.npmjs.com/package/append-transform
Install a transform to require.extensions that always runs last, even if additional extensions are added later
@jsumners
With the proposed change, users of sonic-boom
(along with append-transform
) wouldn't need to worry about configuration.
I'll let @mcollina have the final word. In my view, the reason a reproduction cannot be added to the tests is because there is not a bug here. The newly provided information clearly indicates there is a bug in some other package.
My coworker has agreed for us to downgrade pino
release so that we don't have to spend time on tuning append-transform
.
My PR would allow us (and other users who meet similar error) to upgrade to newer pino
release.
Note: our node version is 18.
Unless a test is added, it's very likely we will regress. Closing for now. Feel free to reopen if you can provide a test.
This PR tries to fix the following compilation error: