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

build / image import broken #498

Closed
Tracked by #24
aheissenberger opened this issue Feb 17, 2024 · 7 comments · Fixed by #499
Closed
Tracked by #24

build / image import broken #498

aheissenberger opened this issue Feb 17, 2024 · 7 comments · Fixed by #499

Comments

@aheissenberger
Copy link
Contributor

an image imported in a server component is missing in the dist/public/assets folder.
It exists in the dist/assets/sample-Xox1zmov.jpg which is not served by the static server.

Waku Commit: e85380c519a899244c548c460de1d0152efdabbc

import SampleImage from '../assets/sample.jpg';

export const MantineCorePage = async () => {
   return (<img src={SampleImage} />)
}
@dai-shi
Copy link
Owner

dai-shi commented Feb 18, 2024

Thanks for reporting.
I think we need to copy image assets like we do with css assets.
Would you like to try? Otherwise, @Aslemammad can probably help.

@dai-shi dai-shi mentioned this issue Feb 18, 2024
83 tasks
@aheissenberger
Copy link
Contributor Author

Thanks for reporting. I think we need to copy image assets like we do with css assets. Would you like to try? Otherwise, @Aslemammad can probably help.

I will give it a look, maybe I can fix it.

@aheissenberger
Copy link
Contributor Author

Fixed the Problem in the ClientBuild - all tests and my new one are green, but I do not know if my change has any other side effects as my code will define all assets with extension !== '.js' as assets which need to be copied to the public asset folder.

@dai-shi
Copy link
Owner

dai-shi commented Feb 18, 2024

Nice!

all assets with extension !== '.js'

I don't know either. Is it possible that a *.json file imported by an RSC which includes secret information leaks to "public"? (Technically there can be "secret" images, though.)

@aheissenberger
Copy link
Contributor Author

Based on the current process I agree with you on the possibility too leak assets to a public folder, but you need to know the hash. And there are valid cases where I fetch an asset (e.g. json) on the client from the server.

I have no idea on how to distinguish between assets which are referenced in the rendered rsc output of an server component(e.g image tag, link tag to a json) and an json file where the content was processed in a server component.

@aheissenberger
Copy link
Contributor Author

These are the rules for public assets:

  • referenced by any code in the client bundle
  • referenced only by the rendered (rsc) output of a server component

Is this parcel api an option to solve this:
https://parceljs.org/plugin-system/bundler/

@dai-shi
Copy link
Owner

dai-shi commented Feb 18, 2024

Okay, let's assume all assets are public by default.
I will later introduce a new vite plugin to allow private assets.

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

Successfully merging a pull request may close this issue.

2 participants