apache / apache/apisix-website

speed up loading JS assets

Open
#675 1 comment 0 reactions 0 assignees View on GitHub
Enhancement stale
Dominant language
JavaScript
Stars
146
Forks
204
Avg merge
2d 3h
Merged PRs (30d)
21

Description

**Actual Behaviour**

Hi, we're using https://docusaurus.io/ V2 to build our website, when it's built after running `yarn build`, it will generate many JS assets under the `build/assets/js/` directory, e.g https://github.com/apache/apisix-website/tree/asf-site/assets/js

And when we visit our website, it will first load the `runtime~main.xxxx.js` file, and it will load all necessary other JS assets asynchronously, but with `relative URL` like the following screenshot:

![image](https://user-images.githubusercontent.com/2106987/138677563-1f84dec6-6f18-464f-8f62-99acd8875730.png)

**Expected Behaviour**

`https://apisix.apache.org/assets/js/69365.a39fd14a.js`.

This URL is correct but I would suggest that we load them from jsDelivr, too. So users in China could visit faster.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the asset loading after running `yarn build`, focusing on `build/assets/js/` and the `runtime~main.xxxx.js` entry described in the issue. Trace where the relative asynchronous asset URLs are generated and verify that the resulting URLs use jsDelivr while the website still loads all required JavaScript.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.