We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
inspired by jso0/html-webpack-cdn-plugin#1
Depends on #13
Type: string || function Default: 'module-to-cdn' || 'module-to-jsdelivr'
string
function
'module-to-cdn' || 'module-to-jsdelivr'
Similar to resolver but the module will be loaded from this CDN only if the main CDN is experiencing issues
resolver
It will create a new file which will contains for each module:
window.React || document.write('<script src="https://unpkg.com/[email protected]/dist/react.js"><\/script>');
NOTE: resolver and fallback must both return a valid cdnConfig otherwise the module is ignored
fallback
cdnConfig
The text was updated successfully, but these errors were encountered:
This would be a better way as it would virtually handles all types of resources, not only JavaScript:
var fallbackUrls = { 'https://unpkg.com/[email protected]/dist/react.js': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/react.min.js' }; window.addEventListener('error', function(e) { var failedUrl = e.target.src || e.target.href if (failedUrl in fallbackUrls) { if (isJs) { document.write('<script src="https://unpkg.com/[email protected]/dist/react.js"><\/script>'); } else { ... } } }, true);
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
inspired by jso0/html-webpack-cdn-plugin#1
Depends on #13
options.fallbackResolver
Type:
string
||function
Default:
'module-to-cdn' || 'module-to-jsdelivr'
Similar to
resolver
but the module will be loaded from this CDN only if the main CDN is experiencing issuesIt will create a new file which will contains for each module:
window.React || document.write('<script src="https://unpkg.com/[email protected]/dist/react.js"><\/script>');
NOTE:
resolver
andfallback
must both return a validcdnConfig
otherwise the module is ignoredThe text was updated successfully, but these errors were encountered: