Skip to content
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

🐛 Can't serve static resources with no filename extension #1098

Closed
davidsoergel opened this issue Mar 29, 2018 · 9 comments
Closed

🐛 Can't serve static resources with no filename extension #1098

davidsoergel opened this issue Mar 29, 2018 · 9 comments
Labels

Comments

@davidsoergel
Copy link

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

NODE_ENV=development parcel serve -d dist --open --no-hmr --public-url / index.html

🤔 Expected Behavior

Static resources placed inside ./dist/ should be served regardless of filename extension.

In particular, files with no extension at all should be served with content-type: application/octet-stream.

😯 Current Behavior

Files with no extension are specifically ignored and the main HTML bundle is sent instead. Adding any extension, even a meaningless one (e.g. .foobar) causes the file to serve properly.

See also #974, #782, and (maybe peripherally related) #536 and #303.

💁 Possible Solution

Remove the "empty extension" test and let the file be served.

🔦 Context

After loading, my webapp fetches static resources that are just blobs with no filename extension. I want to use parcel serve during development, so I just put the static resources under ./dist/ in hopes of serving them. The resource format is not under my control so I can't just add a filename extension to those files.

For now my workaround is to serve just the resources using an http-server on a different port, but that's pretty unwieldy.

🌍 Your Environment

Software Version(s)
Parcel 1.7.0
Node 8.10.0
npm/Yarn 1.4.0
Operating System MacOS 10.13.3
@DeMoorJasper
Copy link
Member

DeMoorJasper commented Mar 29, 2018

This is due to #974 as seen in the discussion there this is intended behaviour...

@devongovett
Copy link
Member

Wait, why do you have files without an extension and how do they get to your dist folder? Parcel doesn’t generate files without extensions

@davidsoergel
Copy link
Author

The use case is described in the "Context" section.

I see that this behavior was introduced on purpose in #974, but the discussion there doesn't say why it should be considered desirable. What am I missing? Thanks!

@nsthorat
Copy link

+1 - I don't think the bundler / http server should be making decisions about file extensions for the application for the author :)

@yingshaoxo
Copy link

I do think that either tensorflow.js or parcel needs to do some serious change.

elwin013/parcel-plugin-static-files-copy#37

tensorflow/tfjs#924

@nestarz
Copy link

nestarz commented Nov 16, 2019

I neither can't use my files without extensions, and I don't have the option to change their names.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label May 15, 2020
@t3hmrman
Copy link

For those who might run into this in the future and want a simple solution that works relatively easily and as expected for Parcel 2 elwin013/parcel-reporter-static-files-copy

@github-actions github-actions bot removed the Stale Inactive issues label Nov 18, 2021
@pulpdood
Copy link

pulpdood commented Feb 2, 2024

I need to verify my domain for Apple Pay, and this requires serving a static file without a file extension, so there is a use case for this. The parcel static files copy reporter, while helpful, doesn't actually solve the issue of parcel not serving files without a file extension.

EDIT: never mind, just realised that files without extensions can be served when built on a server, which works well. It's just not available on locally served environment which is fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants