turbo
                                
                                 turbo copied to clipboard
                                
                                    turbo copied to clipboard
                            
                            
                            
                        [WEB-995] Support tsconfig `nodenext`
It looks like we're nearing Turbo release with 99.7% tests passing, and yet, Turbo is STILL unable to resolve any modules with extensions. I'm getting hundreds and hundreds of errors like:
./packages/site-structure/index.ts:1:0
Module not found: Can't resolve './src/siteStructure.js'
> 1 | import { getSiteStructure } from './src/siteStructure.js';
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2 |
  3 | import type {
  4 |   IPageEntryCollectionPartial,
https://nextjs.org/docs/messages/module-not-found
This is easily resolved with a hack on Webpack's side:
  webpack: (config) => {
    config.resolve.extensionAlias = {
      '.js': ['.js', '.ts', '.tsx'],
    };
    return config;
  },
which is also ridiculous, but at least it works.
this blocks me trying --turbo in nextjs. we use this feature a lot
Would be great if this could be added soon! Can't wait to cut my compile times in half.
At payload we LOVE supporting the latest and greatest next features. And while turbo works, the lack of nodenext support prevents us from running our test suites against turbo, thus we cannot guarantee turbo will work smoothly.
We are using moduleResolution: NodeNext across our entire monorepo, as well as fully-specified imports (that way we can ensure that our packages work outside of bundlers as well). Turbo just errors when it encounters those.
*Sigh* fine, I'll bite.
Introducing next-turbopack-nodenext - a package that patches your Next.js config so that Turbopack could resolve fully specified .js extensions leading to TypeScript files in your src directory.
https://github.com/wojtekmaj/next-turbopack-nodenext
- Install by executing npm install next-turbopack-nodenextoryarn add next-turbopack-nodenext --dev.
- Import by adding import withNodeNext from 'next-turbopack-nodenext'.
- Use it by wrapping your config export default withNodeNext(nextConfig).
Sigh fine, I'll bite.
Introducing next-turbopack-nodenext - a package that patches your Next.js config so that Turbopack could resolve fully specified
.jsextensions leading to TypeScript files in yoursrcdirectory.https://github.com/wojtekmaj/next-turbopack-nodenext
- Install by executing
npm install next-turbopack-nodenextoryarn add next-turbopack-nodenext --dev.- Import by adding
import withNodeNext from 'next-turbopack-nodenext'.- Use it by wrapping your config
export default withNodeNext(nextConfig).
thanks for the effort! however I cannot make it run, is there something in need to add to the next-config (Besides wrapping it with withNodeNext)
i added
experimental: { extensionAlias: [".js"], },
but it did not fix the issue
@macrozone Not even that should be necessary, unless you're unhappy with the default order the plugin looks for files. If you provide a minimum reproduction I'll be happy to look into this. Also, when you have it, please rather raise an issue against my repo, we don't want to clutter this thread any more than necessary.
@macrozone Not even that should be necessary, unless you're unhappy with the default order the plugin looks for files. If you provide a minimum reproduction I'll be happy to look into this. Also, when you have it, please rather raise an issue against my repo, we don't want to clutter this thread any more than necessary.
fair point. So far i settled with not using turbo pack in nextjs, until this is officially supported with ESM.
This PR landed a while back for Turbopack. Will ask Niklas to take a look at the reproduction repo as well.
This should be working now with Next.js 15 (or 15.0.1 for mjs/cjs imports).
Closing as Turbopack as moved homes