turbo
turbo copied to clipboard
Issues while building a React App
What version of Turborepo are you using?
1.3.1
What package manager are you using / does the bug impact?
npm
What operating system are you using?
Mac
Describe the Bug
Context - we are transitioning to a monorepo using Turborepo with React and Cypress apps.
While building the React app using the npm run build command we are receiving the following error:
:build: Module not found: Error: Can't resolve './version' in '/Users/****/Projects/****/app/node_modules/graphql'
:build: Did you mean 'version.mjs'?
:build: BREAKING CHANGE: The request './version' failed to resolve only because it was resolved as fully specified
:build: (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
:build: The extension in the request is mandatory for it to be fully specified.
:build: Add the extension to the request.
What we have tried so far:
Modifying the package.json type property to either commonjs or module. Modifying the actual line in the aforementioned package to have the specified suffix. Thanks in advance!
Expected Behavior
A regular build of the React app.
To Reproduce
- have a react app using CRA: "@craco/craco": "^6.4.3", "react": "^17.0.2"
- Install Graphql in the react app: "graphql": "^15.5.0"
- Install turborepo 1.3.1
- run
npm run build
At what scope are you executing the command. In my project, running from "scope of turbo" not of the "workspace app" solved these issues.
I'm not sure this is a turborepo issue. Could you provide a repo that reproduces if you would like more help?
Closing this down. Feel free to post more info or open a new issue if you're still seeing this @sedric-eyal-peleg!