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

Provide a sub-export for pageview feature #1013

Open
Mister-Hope opened this issue Oct 21, 2024 · 1 comment
Open

Provide a sub-export for pageview feature #1013

Mister-Hope opened this issue Oct 21, 2024 · 1 comment

Comments

@Mister-Hope
Copy link
Contributor

Mister-Hope commented Oct 21, 2024

In most blog sites, there should be no comment box at homepage, timeline, catetgories/tags list.

However, these pages can contain article list, which can contain pageviews of the article.

To achieve the best performance, only pageview feature is needed here. (Especially for homepage, the full artalk chunk should not be forced loaded)

My package Waline provides a standalone pageview chunk as @waline/client/pageview for it, which solves the problem.

The main problem that Artalk has, is that not only it's not providing a separate chunk, but it also do not allow to "tree shake" the feature.

Though loadCountWidget is a sub export for the main module, it's coming from static member from artalk, i.e.:

class Artalk {
 // ...
 static loadCountWidget(e) {
   // ...
 }
}

const loadCountWidget = Artalk.loadCountWidget

export { loadCountWidget }

Suggested solution

  1. make loadCountWidget and all other possible exports tree-shakable. The "server link" should be required when calling these features alone.
  2. provide a separate chunk for pageview feature.
@Mister-Hope
Copy link
Contributor Author

Any update with this one?

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

No branches or pull requests

1 participant