Comments (5)
@kwabe007 this is better for sure, thanks for sharing.
from blues-stack.
I found that even changing https://github.com/remix-run/blues-stack/blob/main/package.json#L10 to this helps a bunch:
"dev": "run-p dev:build dev:remix dev:server",
from blues-stack.
Just ran into this issue today as well when trying to follow this stack's dev/build scripts. Explicitly expanding the script names didn't work for me but as a workaround I've set a three second delay for the dev:server
script:
"delay": "node -e \"setTimeout(() => process.exit(0), 3000)\"",
"dev:server": "npm run delay && cross-env NODE_ENV=development node --inspect --require ./node_modules/dotenv/config --require ./mocks ./build/server.js"
And now it works without having to run npm run build
first.
But it's still a potential race condition though, although the longer the delay the less likely it is.
UPDATE
For anyone reading this in the future: if you don't mind installing an npm package, you can use wait-on to wait for the build files to exist before trying to run node. This way, you don't have to wait longer than needed (or risk not waiting long enough); you'll wait just until the files are built. In my case I installed the package and updated the scripts in package.json
:
"scripts": {
...
"dev:server": "cross-env NODE_ENV=development npm run wait-build && node --inspect --require ./node_modules/dotenv/config --require ./mocks ./build/server.js",
"wait-build": "wait-on -t 20000 ./build/server.js ./build/index.js"
},
The -t 20000
option makes wait-on wait a maximum of 20,000 ms (20 seconds) for the files before failing.
Another alternative if you don't want to add another npm dependency is to write a custom node script which polls for the files existence and use that instead.
from blues-stack.
I'm wondering if this issue should be resolved with the latest release of remix
?
https://github.com/remix-run/remix/releases/tag/remix%401.16.0
I have used the Blue Stack pretty much as-is, so I'm not 100% sure on the internals. But if I understand correctly, couldn't the scripts be changed such that dev
is just a single command?
from blues-stack.
Related Issues (20)
- Wrong http status code (500) returned instead of 404 or any response thrown from a loader. HOT 9
- Hydration error: Initial UI does not match server HOT 3
- New Defer API does not work with blues-stack HOT 11
- When Using Express Adapter Throwing Responses will break the app HOT 1
- great repro
- Base Repo OOMs on Fly.io HOT 6
- Fly.io -> Error: Can't reach database server HOT 7
- `npm run typecheck` fails on fresh project HOT 7
- blues-stack 2.0.0-pre.5 - LiveReload is not working HOT 2
- v2_dev leaves one node process behind after shutdown HOT 1
- Scripts variant in README to support the Yarn inclined
- Deployment issue. Node version >18 needed
- Update server.ts to watch version.txt
- Error when trying to run the docker image HOT 3
- Latest server.js code breaks HDR HOT 1
- Some URLs in the `/build` path were 404 not found after making changes in development mode HOT 1
- Vite support
- Build failed while running npm run build on blues stack HOT 2
- Install an esm package dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blues-stack.