Skip to content

Commit 145c005

Browse files
gkzmeta-codesync[bot]
authored andcommitted
[flow][docs] Rename ESM website files to .mjs to silence Node warning
Summary: Building the website printed `MODULE_TYPELESS_PACKAGE_JSON` because `website/src/js/flow-check-remark-plugin.js` (and the `initialized-flow-provider.js` it imports) use ES module syntax while sitting in a directory whose `package.json` has no `"type": "module"`. Node has to reparse the file as ESM after first parsing it as CommonJS, which triggers the warning. The rest of `website/` (`docusaurus.config.js`, `babel.config.js`, `sidebars.js`, `src/js/flow-versions.js`) is CommonJS and is loaded via `require()`, so flipping the whole package to `"type": "module"` would be disruptive. Renaming just the two ESM files to `.mjs` is the targeted fix — Node treats `.mjs` as ESM unambiguously, no warning, no reparse. The dynamic `import()` in `docusaurus.config.js` is updated to point at the new path. Changelog: [internal] Reviewed By: marcoww6 Differential Revision: D105734893 fbshipit-source-id: 692b11296ebc9ecda13f7ad2ca529f690e045284
1 parent 83f7c6f commit 145c005

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

website/docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ module.exports = async () => ({
247247
}),
248248
remarkPlugins: [
249249
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}],
250-
(await import('./src/js/flow-check-remark-plugin.js')).default,
250+
(await import('./src/js/flow-check-remark-plugin.mjs')).default,
251251
],
252252
},
253253
staticDocsProject: 'flow',

website/src/js/flow-check-remark-plugin.js renamed to website/src/js/flow-check-remark-plugin.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @format
88
*/
99

10-
import getFlowErrors from './initialized-flow-provider.js';
10+
import getFlowErrors from './initialized-flow-provider.mjs';
1111

1212
/*:: type UnwrapPromise<T> = T extends Promise<infer V> ? V : T */
1313

File renamed without changes.

0 commit comments

Comments
 (0)