Skip to content

fix(plugin-assets-retry): url calculation when using asset prefix#2835

Merged
SoonIter merged 6 commits intoweb-infra-dev:mainfrom
SoonIter:lazy-window
Jul 11, 2024
Merged

fix(plugin-assets-retry): url calculation when using asset prefix#2835
SoonIter merged 6 commits intoweb-infra-dev:mainfrom
SoonIter:lazy-window

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Jul 8, 2024

Summary

  1. url calculation when using asset_prefix
image

😄 should add asset_prefix/public_path

domain: ['https://cdn.com', 'https://cdn2.com', 'https://cdn3.com']

1: https://cdn.com/base/app1/static/js/index.js"
2: https://cdn2.com/static/js/index.js
3: https://cdn3.com/static/js/index.js
  1. domain difference between initial chunk and async chunk
// rsbuild.config.ts
pluginAssetsRetry({
	 domain: ['http://localhost:3030', 'http://a.com', 'http://b.com'],
      onRetry(context) {
        console.info('onRetry', context);
      },
      onSuccess(context) {
        console.info('onSuccess', context);
      },
      onFail(context) {
        console.info('onFail', context);
      },
})

before

 onRetryContextList: [
      {
        times: 0,
        domain: '<ORIGIN>/static/js/index.js',
        // domain: '/'  // async
        url: '<ORIGIN>/static/js/index.js',
        tagName: 'script',
      },
      {
        times: 1,
        domain: 'http://a.com',
        url: 'http://a.com/static/js/index.js',
        tagName: 'script',
      },
      {
        times: 2,
        domain: 'http://b.com',
        url: 'http://b.com/static/js/index.js',
        tagName: 'script',
      },
    ],
    onFailContextList: [
      {
        times: 3,
        domain: '<ORIGIN>',
        url: '<ORIGIN>/static/js/index.js',
        tagName: 'script',
      },
    ],
    onSuccessContextList: [],

after

 onRetryContextList: [
      {
        times: 0,
        domain: '<ORIGIN>',
        url: '<ORIGIN>/static/js/index.js',
        tagName: 'script',
      },
      {
        times: 1,
        domain: 'http://a.com',
        url: 'http://a.com/static/js/index.js',
        tagName: 'script',
      },
      {
        times: 2,
        domain: 'http://b.com',
        url: 'http://b.com/static/js/index.js',
        tagName: 'script',
      },
    ],
    onFailContextList: [
      {
        times: 3,
        domain: '<ORIGIN>',
        url: '<ORIGIN>/static/js/index.js',
        tagName: 'script',
      },
    ],
    onSuccessContextList: [],

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link
Copy Markdown

netlify bot commented Jul 8, 2024

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit c16144e
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/668fcbf258090c0008cfeb6f
😎 Deploy Preview https://deploy-preview-2835--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 83 (🟢 up 4 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@SoonIter SoonIter changed the title fix: url calculation fix(plugin-assets-retry): url calculation Jul 10, 2024
@SoonIter SoonIter marked this pull request as ready for review July 10, 2024 08:13
@SoonIter SoonIter marked this pull request as draft July 10, 2024 08:13
@SoonIter SoonIter force-pushed the lazy-window branch 2 times, most recently from 81e5593 to 2a6f1e7 Compare July 11, 2024 08:57
@SoonIter SoonIter changed the title fix(plugin-assets-retry): url calculation fix(plugin-assets-retry): url calculation when using asset_prefix Jul 11, 2024
@SoonIter SoonIter marked this pull request as ready for review July 11, 2024 09:18
@SoonIter SoonIter requested a review from chenjiahan July 11, 2024 09:18
@SoonIter SoonIter enabled auto-merge (squash) July 11, 2024 11:13
@chenjiahan chenjiahan changed the title fix(plugin-assets-retry): url calculation when using asset_prefix fix(plugin-assets-retry): url calculation when using asset prefix Jul 11, 2024
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

👍

@SoonIter SoonIter merged commit ce6a61a into web-infra-dev:main Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants