Skip to content

Commit 544e352

Browse files
authored
fix: Revert "fix: resolve cjs deps as cjs instead of esm (#362)" (#365)
This reverts commit 1eba4d5. The fix in the original PR did solve the problem of tracing a dependency being loaded from an ESM file via `require()`, but also caused a regression where a simple `.mjs` file with ESM imports was failing. I have a test (#364) for that.
1 parent 1eba4d5 commit 544e352

5 files changed

Lines changed: 3 additions & 28 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"@types/graceful-fs": "^4.1.5",
4545
"@types/micromatch": "^4.0.1",
4646
"@types/node": "^14.14.37",
47-
"@vercel/edge-config": "^0.4.0",
4847
"analytics-node": "^3.4.0-beta.1",
4948
"apollo-server-express": "^2.14.2",
5049
"argon2": "^0.31.1",

src/node-file-trace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class Job {
328328
else
329329
await this.emitFile(asset, 'asset', path);
330330
}),
331-
...[...deps].map(async dep => this.maybeEmitDep(dep, path, !isESM || this.mixedModules)),
331+
...[...deps].map(async dep => this.maybeEmitDep(dep, path, !isESM)),
332332
...[...imports].map(async dep => this.maybeEmitDep(dep, path, false)),
333333
]);
334334
}

test/integration.test.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const integrationDir = `${__dirname}${path.sep}integration`;
1313
for (const integrationTest of readdirSync(integrationDir)) {
1414
it(`should correctly trace and correctly execute ${integrationTest}`, async () => {
1515
console.log('Tracing and executing ' + integrationTest);
16-
const mixedModules = integrationTest === 'vercel-edge-config-esm.mjs';
1716
const nftCache = {}
1817
const fails = integrationTest.endsWith('failure.js');
1918
const { fileList, reasons, warnings } = await nodeFileTrace([`${integrationDir}/${integrationTest}`], {
@@ -22,8 +21,7 @@ for (const integrationTest of readdirSync(integrationDir)) {
2221
base: path.resolve(__dirname, '..'),
2322
processCwd: integrationDir,
2423
// ignore other integration tests
25-
ignore: ['test/integration/**'],
26-
mixedModules
24+
ignore: ['test/integration/**']
2725
});
2826
// warnings.forEach(warning => console.warn(warning));
2927
const randomTmpId = Math.random().toString().slice(2)
@@ -64,8 +62,7 @@ for (const integrationTest of readdirSync(integrationDir)) {
6462
base: path.resolve(__dirname, '..'),
6563
processCwd: integrationDir,
6664
// ignore other integration tests
67-
ignore: ['test/integration/**'],
68-
mixedModules
65+
ignore: ['test/integration/**']
6966
});
7067
expect([...cachedResult.fileList].sort()).toEqual([...fileList].sort())
7168
}

test/integration/vercel-edge-config-esm.mjs

Lines changed: 0 additions & 9 deletions
This file was deleted.

yarn.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,18 +2420,6 @@
24202420
dependencies:
24212421
"@types/node" "*"
24222422

2423-
"@vercel/edge-config-fs@0.1.0":
2424-
version "0.1.0"
2425-
resolved "https://registry.yarnpkg.com/@vercel/edge-config-fs/-/edge-config-fs-0.1.0.tgz#cda8327f611418c1d1cbb28c6bed02d782be928b"
2426-
integrity sha512-NRIBwfcS0bUoUbRWlNGetqjvLSwgYH/BqKqDN7vK1g32p7dN96k0712COgaz6VFizAm9b0g6IG6hR6+hc0KCPg==
2427-
2428-
"@vercel/edge-config@^0.4.0":
2429-
version "0.4.0"
2430-
resolved "https://registry.yarnpkg.com/@vercel/edge-config/-/edge-config-0.4.0.tgz#e3649125778d450e6702dfa3ed7ad3e93e16d2c4"
2431-
integrity sha512-v8AKiW/Tp9S79xapH3gXmOPXkkzJhUNnpyL6OX8xbHJvP7y5x0Oo/v/FUsGHpgay1x8a5vpddTH0Upw04RQcRA==
2432-
dependencies:
2433-
"@vercel/edge-config-fs" "0.1.0"
2434-
24352423
"@webcomponents/template@^1.4.0":
24362424
version "1.4.4"
24372425
resolved "https://registry.yarnpkg.com/@webcomponents/template/-/template-1.4.4.tgz#2ca5a68b65b6e9cd9b17b25a951514f254c00742"

0 commit comments

Comments
 (0)