Visitar URL original
fix(scripts): specify loader via NODE_OPTIONS by caugner · Pull Request #10865 · mdn/yari · GitHub
Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

fix(scripts): specify loader via NODE_OPTIONS - #10865

Merged
fiji-flo merged 4 commits into
mainfrom
fix-scripts-specify-loader-via-node-options
Apr 8, 2024
Merged

fiji-flo merged 4 commits into
mainfrom
fix-scripts-specify-loader-via-node-options

Conversation

@caugner

@caugner caugner commented Apr 8, 2024

Copy link
Copy Markdown
Contributor

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 a review from mdn-bot as a code owner April 8, 2024 10:27
@caugner
caugner requested a review from a team April 8, 2024 10:27
Comment thread package.json Resolved
Comment thread package.json Resolved
Comment thread package.json Resolved
Comment thread package.json Resolved
@fiji-flo
fiji-flo merged commit 842c316 into main Apr 8, 2024
@fiji-flo
fiji-flo deleted the fix-scripts-specify-loader-via-node-options branch April 8, 2024 11:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants