Closed antfu closed 3 weeks ago
:tada: This issue has been resolved in v4.13.1
If you appreciate this project, please consider supporting this project by sponsoring :heart: :pray:
Hm, I'm seeing 0a78bfd11b20fcb6460fdcdea7d3b1daebfe3ad0 and tsx@4.13.1
break our projects:
$ tsx scripts/seedDatabase.ts
/home/runner/work/courses/courses/packages/database/util/connect.ts:2
import { cache } from 'next/dist/compiled/react/index.js';
^
SyntaxError: The requested module 'next/dist/compiled/react/index.js' does not provide an export named 'cache'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:3[16](https://github.com/upleveled/courses/actions/runs/9413420232/job/25930125960?pr=2494#step:12:17):24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Node.js v20.14.0
Not sure why tsx@4.13.1
is having trouble resolving the cache
export in compiled/react/index.js
:
compiled/react/index.js
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react.production.js');
} else {
module.exports = require('./cjs/react.development.js');
}
compiled/react/cjs/react.development.js
// ...
exports.cache = cache;
// ...
Downgrading to tsx@4.13.0
resolves this.
Acknowledgements
Minimal reproduction URL
https://github.com/antfu/repro-tsx-tsimport-cts
Problem & expected behavior (under 200 words)
In repro's README
Bugs are expected to be fixed by those affected by it
Compensating engineering work financially will speed up resolution