How to get verbose log from react-scripts build script? - reactjs

I upgraded to the react-scripts v5 and my build fails with an unuseful message:
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve '...' in '/project/src'
As you can see it only tells me that there was a problem in the src directory, which is literally the entire project.
How can I increase verbosity of this script?

Do you have the index.js file inside project/src? Does it have import from ... (or /project/index.js)?

Related

Vite esbuild failing for old Non-ESM package

I'm trying to use glsl-transpiler(https://github.com/stackgl/glsl-transpiler) with my vite project but am running into issues with esbuild, which outputs
[ERROR] [plugin vite:dep-pre-bundle] Failed to resolve entry for package "escaper". The package may have incorrect main/module/exports specified in its package.json.
Adding optimizeDeps: {exclude:['glsl-transpiler']} to defineConfig in vite.config.js allows the app to build, but I get a require is not defined error when I try to use the package due to the https://github.com/stackgl/glsl-transpiler/blob/master/index.js ll:8.
Does anyone know how I can successfully use this old package and its old dependencies in my project?

npm run build failed to create build file

Creating an optimized production build...
Failed to compile.
static/css/main.e6c44930.css from Css Minimizer plugin
/home/joy/7thSem_project/Food_order/static/css/main.e6c44930.css:406:58: Missed semicolon [webpack://./src/components/Meals/AvailableMeals.module.css:5,4][static/css/main.e6c44930.css:406,58]
create build file successfully

Error at deploy a react project on vercel

I am receiving an error when i try to deploy using vercel, i created the app with vite
this is what i get:
vite v3.0.2 building for production...
transforming...
✓ 42 modules transformed.
[vite]: Rollup failed to resolve import "swiper/react" from "src/components/Slider.jsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "swiper/react" from "src/components/Slider.jsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
at onRollupWarning (file:///vercel/path0/node_modules/vite/dist/node/chunks/dep-1513d487.js:43558:19)
at onwarn (file:///vercel/path0/node_modules/vite/dist/node/chunks/dep-1513d487.js:43349:13)
at Object.onwarn (file:///vercel/path0/node_modules/rollup/dist/es/shared/rollup.js:23177:13)
at ModuleLoader.handleResolveId (file:///vercel/path0/node_modules/rollup/dist/es/shared/rollup.js:22334:26)
at file:///vercel/path0/node_modules/rollup/dist/es/shared/rollup.js:22295:26
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Command "npm run build" exited with 1```
Any suggestion on how to solve it?

Error deploying vite + react application to Heroku

I'm trying to deploy my app to Heroku.
When I run npm build on my machine, it works.
But when Heroku runs npm build, it cannot transform a module in my app.
The build log gives the following:
Build
Running build
> taleme#1.0.0 build
> vite build
vite v2.7.10 building for production...
transforming...
✓ 32 modules transformed.
Could not resolve './taleme/LocalMultiplayer' from src/Game.tsx
error during build:
Error: Could not resolve './taleme/LocalMultiplayer' from src/Game.tsx
at error (/tmp/build_fa45ef37/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:158:30)
at ModuleLoader.handleResolveId (/tmp/build_fa45ef37/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:22384:24)
at /tmp/build_fa45ef37/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:22363:26
at processTicksAndRejections (node:internal/process/task_queues:96:5)
[!] Error: unfinished hook action(s) on exit:
(vite:css) transform "/tmp/build_fa45ef37/src/index.css"
(vite:load-fallback) load "/tmp/build_fa45ef37/src/taleme/LobbyView.tsx"
When I try to temporarily remove this import, a different module imported somewhere else pops in with this error.
I've got no clue as to why vite cannot perform the transform on Heroku.
Any help would be greatly appreciated!
Turns out it was a bug in windicss,
fixed in v3.4.3.

React npm "module build failed (from ./node_modules/babel-loader/lib/index.js)"

I am trying to setup React environment and I am getting two errors when running npm start in command prompt.
First error is "module build failed (from ./node_modules/babel-loader/lib/index.js)" and second is
"error plugin/preset files are not allowed to export objects only functions".
Any idea how this could be solved? I am new to this whole thing so please try to keep answer simple and steps easy to follow.
change your directory and install your app again via this code :
npx create-react-app yourAppName
then install all dependencies

Resources