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] replace kit.paths.base if it runs on localhost #2318

Closed
wants to merge 3 commits into from

Conversation

baseballyama
Copy link
Member

@baseballyama baseballyama commented Aug 29, 2021

fix: #2230

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpx changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

Explain What I Did

In this PR #2189, the way of handle for kit.paths.assets in svelte.config.js was changed.
After that, the issue #2230 comes.

I think this issue is only a problem in a dev environment like localhost.
(Please check details at here)

So I just handled this issue as like workaround code.

As an alternative way, we can modify module bunder (like Vite).
In this case, we can create a folder which is the value of kit.paths.assets as the parent of the _app folder. (And maybe something more.)
But in my opinion, we will have a chance to handle this issue for each module bundler.
This is just a little bit troublesome.
Therefore I choose this simple way.

So could you please review this way is reasonable?
Or should I modify Vite or somewhere else?

MEMO

  1. I don't know how to do the brawser test with npm run dev command. Please tell me how can I add a test for it.

  2. When I execute pnpx changeset, it shows If you are unsure if this is correct, contact the package's maintainers before committing this changeset, so now I didn't create changeset. (After getting a review comment, I will create it.)

Thank you!

@changeset-bot
Copy link

changeset-bot bot commented Aug 29, 2021

🦋 Changeset detected

Latest commit: e56abff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@baseballyama
Copy link
Member Author

baseballyama commented Aug 29, 2021

I realized that just using replace() has chance to mis-replacement if middle of file path has path which is same as base path.
So I will fix it but I'm happy if someone review for this fixing policy!

edit: I fixed it up.

Copy link
Contributor

@dreitzner dreitzner left a comment

Choose a reason for hiding this comment

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

Lgtm

@baseballyama baseballyama changed the title replace kit.paths.base if it runs on localhost [fix] replace kit.paths.base if it runs on localhost Aug 31, 2021
@benmccann
Copy link
Member

benmccann commented Sep 12, 2021

Another PR to fix this issue has been submitted to fix paths.base at #2407. I'm not that familiar with this code and haven't looked closely at either PR yet to know which makes more sense

@baseballyama
Copy link
Member Author

I discussed about this PR with the author of #2407.
And I think we should adopt #2407 instead of this PR.
Therefore I will close this PR after merge #2407 if nothing happens.

@benmccann
Copy link
Member

Ok, I'll just go ahead and close it now then

@benmccann benmccann closed this Sep 13, 2021
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.

Addding config.kit.paths.base breaks npm run build
3 participants