demonstrate mjs file identified as esm, but handled as cjs
When a .mjs file is traced, it adds all import into deps instead of imports. Later in the tracing, it treats deps as CJS and it incorrectly resolves the default export for the playwright-core package.
This regression was introduced by https://github.com/vercel/nft/pull/362, but that PR does fix the issue of CJS files being resolved incorrectly.
I don't know the background, but it seems all imports, especially in .mjs files, should go into imports, not deps.
@styfle can you please advise?
Test failure:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/private/var/folders/tr/t1h0gs514fl543bw43pchxpw0000gn/T/node-file-trace-0564114059456724/node_modules/playwright-core/index.mjs' imported from /private/var/folders/tr/t1h0gs514fl543bw43pchxpw0000gn/T/node-file-trace-0564114059456724/test/integration/playwright-core-esm.mjs
Did you mean to import playwright-core/index.js?
at new NodeError (node:internal/errors:387:5)
at finalizeResolution (node:internal/modules/esm/resolve:330:11)
at moduleResolve (node:internal/modules/esm/resolve:907:10)
at defaultResolve (node:internal/modules/esm/resolve:1115:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:837:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36) {
@cb1kenobi This test is passing https://github.com/vercel/nft/actions/runs/6384547761/job/17327429573?pr=364#step:8:6107
Is that because it doesn't set mixedModules: true?
@styfle Correct. I didn't commit the change to integration.test.js that enables mixedModules = true for this test.