NX/React build omits index.html when run from sub directories
See original GitHub issueCurrent Behavior
running npx nx run myApp:build:production --outputPath=apps/myApp/dist
has different output depending on the directory I am in. When running from root, the dist
output includes the index.html
file. However when running from within apps/myApp
the index.html
is missing from dist
. All other files are there as expected.
Expected Behavior
I would expect that running this command from within a sub directory would have the same output.
Steps to Reproduce
- initialize an nx/react project.
- run the nx build command from root and then from an app dir.
This issue may not be prioritized if details are not provided to help us reproduce the issue.
Failure Logs
here is a snippet from my project:
➜ admin git:(tv-vercel-mono) npx nx run admin:build:production --outputPath=apps/admin/dist
> nx run admin:build:production --outputPath=apps/admin/dist
Entrypoint main [big] 805 KiB = runtime.195b16c2abc3ca51.esm.js 1.63 KiB main.d0af681030aa95b2.esm.js 803 KiB
Entrypoint polyfills 89.3 KiB = runtime.195b16c2abc3ca51.esm.js 1.63 KiB polyfills.40cb8470664ba0b9.esm.js 87.7 KiB
chunk (runtime: runtime) main.d0af681030aa95b2.esm.js (main) 2.59 MiB [initial] [rendered]
chunk (runtime: runtime) polyfills.40cb8470664ba0b9.esm.js (polyfills) 286 KiB [initial] [rendered]
chunk (runtime: runtime) runtime.195b16c2abc3ca51.esm.js (runtime) 4.4 KiB [entry] [rendered]
webpack compiled successfully (a57b91cd5c93fdf3)
ENOENT: no such file or directory, open 'apps/admin/dist/index.html'
Environment
The reason I would like this to behave in the expected way, is because I am using vercel which requires configuring “root dirs” to have projects with different redirect and rewrite rules.
Issue Analytics
- State:
- Created a year ago
- Reactions:7
- Comments:5
Top Results From Across the Web
Vite is not serving index.html from subdirectories
Hover when I visit http://localhost:5173/reports it doesn't serve index.html that is located inside reports folder.
Read more >Delightful React File/Directory Structure - Josh W Comeau
I want a “components” directory, a “hooks” directory, a “helpers” directory, and so on. Sometimes, a complex component will have a bunch of ......
Read more >Effective React Development with Nx
A folder created using Nx that contains applications and libraries, as well as scaffolding to help with building, linting, and testing. Project.
Read more >How to deploy a React app to a subdirectory | by Scott Vinkle
For the past month or so I've been working on a prototype app built with the React JavaScript library. It's been a lot...
Read more >Ubuntu Manpage: igal2 - online Image GALlery generator
To try it out just run igal2 in a directory with jpg, gif or png files ... the subdirectories "Videos" and "Documents_of_interest" in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think this issue needs to get more attention
Same