Which canary version will you have in your reproduction?
turbo 2.3.0
Enviroment information
I first discovered the problem at work on a very modern Mac; however, we aren't allowed to use personal github accounts at work, so I have reproduced the problem on a very ancient Windows machine.
CLI:
Version: 2.3.0
Path to executable: C:\Users\Andy\Documents\workspace\turbo-next-config-bug\node_modules\.pnpm\turbo-windows-64@2.3.0\node_modules\turbo-windows-64\bin\turbo.exe
Daemon status: Not running
Package manager: pnpm
Platform:
Architecture: x86_64
Operating system: windows
WSL: false
Available memory (MB): 6157
Available CPU cores: 4
Environment:
CI: None
Terminal (TERM): unknown
Terminal program (TERM_PROGRAM): vscode
Terminal program version (TERM_PROGRAM_VERSION): 1.95.3
Shell (SHELL): unknown
stdin: false
Expected behavior
The default parser should read from the default.json config. The compiler should not try to load any of the non-default parsers.
Actual behavior
When I run pnpm dev and then load the web page, I am getting the following error:
./node_modules/.pnpm/config@3.3.12/node_modules/config/parser.js:114:16
Module not found: Can't resolve 'coffee-script'
112 | catch (e) {
113 | // If it doesn't exist, try to load it using the deprecated module name
> 114 | Coffee = require(COFFEE_DEP);
| ^^^^^^^^^^^^^^^^^^^
115 | }
116 | // coffee-script >= 1.7.0 requires explicit registration for require() to work
117 | if (Coffee.register) {
https://nextjs.org/docs/messages/module-not-found
To Reproduce
run pnpm dev
load the web page on localhost:3000 or 3001 (one of them will be the docs, the other web)
Additional context
I have created a bare-bones turbo-repo with pnpm using npx create-turbo@latest. It works as expected. I have next added the package 'config' v3.3.12 to the 'web' application and am attempting to import config in page.tsx to read a test value 'key' from the default config.
When I run pnpm dev and then load the web page, I am getting the following error:
./node_modules/.pnpm/config@3.3.12/node_modules/config/parser.js:114:16
Module not found: Can't resolve 'coffee-script'
112 | catch (e) {
113 | // If it doesn't exist, try to load it using the deprecated module name
> 114 | Coffee = require(COFFEE_DEP);
| ^^^^^^^^^^^^^^^^^^^
115 | }
116 | // coffee-script >= 1.7.0 requires explicit registration for require() to work
117 | if (Coffee.register) {
https://nextjs.org/docs/messages/module-not-found
I don't think this is the correct behavior. I don't think that Next.js should be trying to load the coffee-script module. I have used the 'config' module in every Next.js application that I have ever used, and I have never had to install coffee-script.
We are also seeing the same error for all of the other non-default (non-json) parsers in config's parser.js file. By manually added logging to the various parsers in config, I have determined that the functions which require the various parsers are never called. This appears to be a bogus compile step.
I have also confirmed, by overwriting all of the non-default parsers with return {} that the default parser is working correctly as expected.
This isn't an issue with Turborepo since it happens without invoking turbo e.g. pnpm dev directly in apps/web. Did you mean Turbopack? If so you can open an issue in vercel/next.js.
Verify canary release
Link to code that reproduces this issue
https://github.com/asinning/turbo-next-config-bug
Which canary version will you have in your reproduction?
turbo 2.3.0
Enviroment information
Expected behavior
The default parser should read from the default.json config. The compiler should not try to load any of the non-default parsers.
Actual behavior
When I run
pnpm dev
and then load the web page, I am getting the following error:To Reproduce
run
pnpm dev
load the web page on localhost:3000 or 3001 (one of them will be the docs, the other web)
Additional context
I have created a bare-bones turbo-repo with pnpm using
npx create-turbo@latest
. It works as expected. I have next added the package 'config' v3.3.12 to the 'web' application and am attempting to import config in page.tsx to read a test value 'key' from the default config.https://github.com/asinning/turbo-next-config-bug/blob/ccd51546582cdbdaef4d7f4b3d6c9c9e7be76a18/apps/web/app/page.tsx#L2
When I run
pnpm dev
and then load the web page, I am getting the following error:I don't think this is the correct behavior. I don't think that Next.js should be trying to load the coffee-script module. I have used the 'config' module in every Next.js application that I have ever used, and I have never had to install coffee-script.
We are also seeing the same error for all of the other non-default (non-json) parsers in config's parser.js file. By manually added logging to the various parsers in config, I have determined that the functions which require the various parsers are never called. This appears to be a bogus compile step.
I have also confirmed, by overwriting all of the non-default parsers with
return {}
that the default parser is working correctly as expected.