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

fix: non js assets path should add config.basePath to be relative to root path #697

Merged
merged 2 commits into from
May 5, 2024

Conversation

PerfectPan
Copy link
Contributor

Solve #649.

I did some research based on #674. The root cause is that css path in html missing / so that when brower try to join the real path, it will use the current path instead of root path.

CleanShot 2024-05-05 at 00 44 55@2x

CleanShot 2024-05-05 at 00 45 27@2x

Copy link

vercel bot commented May 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview May 5, 2024 2:54am

Copy link

codesandbox-ci bot commented May 4, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Owner

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for investigating into it! It looks valid.
We use basePath instead of /. (Though, we don't have tests and changing basePath in config might not fully work, yet. Contributions are welcome.)

packages/waku/src/lib/plugins/vite-plugin-rsc-index.ts Outdated Show resolved Hide resolved
packages/waku/src/lib/builder/build.ts Outdated Show resolved Hide resolved
@PerfectPan PerfectPan changed the title fix: non js assets path should add / to be relative to root path fix: non js assets path should add config.basePath to be relative to root path May 5, 2024
@PerfectPan
Copy link
Contributor Author

PerfectPan commented May 5, 2024

Thanks for investigating into it! It looks valid. We use basePath instead of /. (Though, we don't have tests and changing basePath in config might not fully work, yet. Contributions are welcome.)

I totally ignore the basePath option lol. I have already changed the code.

For changing basePath in config, I tried and it seems not working well.

CleanShot 2024-05-05 at 10 58 35@2x

This may involve the paths of resources in HTML files, the paths of generated files, and the paths for server hosting static resources. It seems that something is not quite right with all of them.

CleanShot 2024-05-05 at 11 03 06@2x

CleanShot 2024-05-05 at 11 04 29@2x

Would you mind I open an another issue to follow this and try to add test cases and solution later?

@dai-shi
Copy link
Owner

dai-shi commented May 5, 2024

Yeah, we have the basePath config but it's never used in cli.ts.
(I guess it would be app.use('/test/*', ...).)

Please open a new issue and maybe our first target would be SSG.

This was referenced May 5, 2024
Copy link
Owner

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks okay.

I wonder if @Aslemammad can give a review too.

Copy link
Contributor

@Aslemammad Aslemammad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean & Simple! I love the catch.

@dai-shi dai-shi merged commit 91c4c84 into dai-shi:main May 5, 2024
28 checks passed
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 this pull request may close these issues.

3 participants