Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scripts): specify loader via NODE_OPTIONS #10865

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Apr 8, 2024

Summary

Problem

Node 18.19 contains this change, which causes the following error:

% yarn build:blog                                                                                                                                                                                                              
yarn run v1.22.22
$ cross-env NODE_ENV=production ts-node build/build-blog.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /path/to/mdn/yari/build/build-blog.ts
    at new NodeError (node:internal/errors:405:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:136:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:182:36)
    at defaultLoad (node:internal/modules/esm/load:101:20)
    at nextLoad (node:internal/modules/esm/hooks:864:28)
    at load (/path/to/mdn/yari/node_modules/ts-node/dist/child/child-loader.js:19:122)
    at nextLoad (node:internal/modules/esm/hooks:864:28)
    at Hooks.load (node:internal/modules/esm/hooks:447:26)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:786:20) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Solution

Replace ts-node invocations by NODE_OPTIONS='--no-warnings=ExperimentalWarning --loader ts-node/esm' node.


How did you test this change?

Ran all changed scripts before/after and verified that they now work.

@caugner caugner requested review from mdn-bot and a team as code owners April 8, 2024 10:27
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@fiji-flo fiji-flo merged commit 842c316 into main Apr 8, 2024
16 checks passed
@fiji-flo fiji-flo deleted the fix-scripts-specify-loader-via-node-options branch April 8, 2024 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants