It's possible to produce a "successful" build that yields no JS bundle or HTML
See original GitHub issueAre you reporting a bug?
Yes. It’s possible to produce a “successful” build that yields no JS bundle or HTML. I stumbled across this issue when one of my data API end-point was unavailable.
Environment
react-static -V
: 6.1.4node -v
: 8.9.0npm -v
: 5.5.1- Operating system: Mac OS
- Browser and version (if relevant): N/A
Steps to Reproduce the problem
- Run
react-static create
and select thebasic
template - Edit
static.config
to return an empty array fromgetRoutes
- Delete
src/pages
- Run
yarn build
- Observe that, despite a console warning of no “index” page, build is successful, and that
dist
contains justreact-static-browser-plugins.js
- Edit
static.confg
and throw an error fromgetRoutes
- Run
yarn build
- Observe that build is successful, and that
dist
contains justreact-static-browser-plugins.js
Expected Behavior
Because there are no “page” routes or routes returned by getRoutes
, yarn build
should fail with exit code 1 in both cases. Previous in v5, when I threw an error caused by an unavailable end-point the build would fail. The current v6 behaviour can result in a CI tool such as Netlify deploying the minimal dist
directory
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Webpack-dev-server not bundling even after showing bundle ...
The project seems to be working fine with just webpack cmd. It builds into my build folder and I can get it working...
Read more >How to Bundle a Simple Static Site Using Webpack - SitePoint
The first thing you'll need is to have Node and npm installed on your ... And webpack will create a bundle.js file in...
Read more >Comparing the New Generation of Build Tools - CSS-Tricks
Using the “minify” and “bundle” options in your esbuild command won't create a bundle quite as small as a Rollup/Terser pipeline. This is ......
Read more >Production - Parcel
Parcel's production mode automatically bundles and optimizes your application for production. It can be run using the parcel build command:
Read more >Slimming down your bundle size - LogRocket Blog
Separating JavaScript assets into separate files does require a lot of HTTP requests when different parts of the application require different ...
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
v7 uses a whole new flow for CLI commands and should no longer swallow errors. If you still run into this error in the new version, please reopen this issue!
Thanks for your feedback on this as always.
After a passthrough of this logical tree and some debugging, I couldn’t find where the error’s are getting swallowed. I’m going to do another run-through later this week.