diff --git a/.changeset/unlucky-apricots-report.md b/.changeset/unlucky-apricots-report.md new file mode 100644 index 00000000..03f9a32d --- /dev/null +++ b/.changeset/unlucky-apricots-report.md @@ -0,0 +1,5 @@ +--- +"vscode-apollo": patch +--- + +Fix a situation where config files using `require` would not be imported as CommonJS. diff --git a/src/language-server/config/loadTsConfig.ts b/src/language-server/config/loadTsConfig.ts index 6cfa000c..04700d17 100644 --- a/src/language-server/config/loadTsConfig.ts +++ b/src/language-server/config/loadTsConfig.ts @@ -93,7 +93,8 @@ export const loadJs: Loader = async function loadJs(filepath, contents) { if ( error instanceof Error && // [ERROR] ReferenceError: module is not defined in ES module scope - error.message.includes("module is not defined") + // [ERROR] ReferenceError: require is not defined in ES module scope + error.message.includes("is not defined in ES module scope") ) { return loadCachebustedJs(filepath, contents, "commonjs"); } else {