-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support a static data directory #2461
Conversation
Quick poke on this one again, since it is vital to my workflow. |
What happens if you use files in that folder? e.g. Related: |
From my understanding, if the Parcel bundler logic pulls in "data/...", then it will serve the bundled version rather than the version from the static data dir. Should this happen? I don't know. One of the downsides to a "no-config" bundler is that when you have two competing conventions, you have to pick one of them, since you have no way of inferring the user's intent, and they can't configure it. Currently, I only care about the XHR case, and as such this flag doesn't alter bundler behavior (it's a flag for the dev server, so it only exists on serve). |
df7cdac
to
430f8f0
Compare
Can I request another review of this? I fixed the concern found two weeks ago. |
430f8f0
to
393ab0b
Compare
Pushed an update. Can I get another review of this feature? The test failing doesn't look like my fault. |
Another ping. Please. This is a blocking issue for my workflow. |
This is my take on the need to serve static data from the dev server. Anything served from this path will be served as raw as possible, with 404s for missing files, and no index file.
Perhaps we can just remove this check: I don't really want to add another option for a static directory if we can help it. |
Actually reporting a 404 error is an important part of my workflow. Additionally, this removes the need to place files into the dist/ folder, which is a bit sketchy since you might want to wipe it at any time. |
This wouldn't change the existing 404 behavior. We have no way to know if we should emit a 404 or the index.html due to SPAs with client side routers. We need to serve the index.html so that the actual routing is delegated to the client. |
This feature makes it so that if you pass |
I'm not sure I understand why this feature is necessary. We can fix the original bug of not serving files without extensions as I described above. I'd rather not add a new option to parcel if it can be avoided. Parcel will already copy files into the dist directory if they are referenced in the code (e.g. with |
These are large binary files that I load at runtime (3D models) that I use XHR for. They can be 100MB in size. Importing does not seem like a smart idea. I would simply like to mirror this directory into the HTTP dev server, with typical "static data" rules (404s for missing files). |
That will copy the file into the dist dir for you and give you back a URL to the final asset. It's not going to put the asset in your JS or anything. |
The URLs to these assets are dynamically constructed at runtime, they are not static, so importing will not work. During production deployment I serve these assets from a separate CDN server. Please don't try to dictate my application architecture. |
If it's a separate server in prod, you should make a separate server for dev to serve those assets as well so that the it matches prod as much as possible. I don't think it should be parcel's job to be a static file server in addition to a dev server. If you'd like to fix the original bug, please open a new PR. |
Having two servers for development feels like a bizarre direction to go. However, it's possible that my needs here are unique. I might make my own server script based on Parcel's dev server library. |
This is my take on the need to serve static data from the dev server.
Anything served from this path will be served as raw as possible, with
404s for missing files, and no index file.
Solves #1425 #1948 and maybe others.
↪️ Pull Request