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

Make +client.js cumulative #1834

Open
brillout opened this issue Aug 29, 2024 · 2 comments
Open

Make +client.js cumulative #1834

brillout opened this issue Aug 29, 2024 · 2 comments
Labels
enhancement ✨ New feature or request high-prio 💫

Comments

@brillout
Copy link
Member

brillout commented Aug 29, 2024

Description

Currently +client.js isn't cumulative. But it should be.

pages/+client.js
# This currently overrides pages/+client.js (but it shouldn't)
pages/some-page/+client.js

In the meantime the workaround is to do this:

// pages/some-page/+client.js

// Import pages/+client.js
import '../client.js'
@brillout brillout added enhancement ✨ New feature or request high-prio 💫 labels Aug 29, 2024
@aheissenberger
Copy link

My first use case is adding Sentry Browser Error Tracking. For this the requirements is to be load on all pages.

My second use case was adding a simple script to one of the pages in a setup without any frontend framework (plain html). This script is only relevant on the page in the same folder and not relevant to pages in any folder beneath.

I think your workaround is not such a bad solution except for the ../../../+client.js in deeper folders which could be fixed with some configurations setting.

Maybe an update of the documentation would help:

  1. information about +client.js not being cumulative
  2. solution for use cases which need composition of global and local

@brillout
Copy link
Member Author

  1. Done.
  2. Correct me if I'm wrong but I guess the workaround mentioned here does the trick for now.

(Btw. your contributions to Bati are very much appreciated 💚 feel free to PM me on Discord!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request high-prio 💫
Projects
None yet
Development

No branches or pull requests

2 participants