Skip to content

Commit

Permalink
Try cdn again
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Dec 23, 2020
1 parent 00cb936 commit 2c9c58e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cndocs/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ An iOS Alert type.
**常量:**
| Value | 说明 |
| | 说明 |
| ------------------ | ---------------------------- |
| `'default'` | Default alert with no inputs |
| `'plain-text'` | Plain text input alert |
Expand Down
2 changes: 1 addition & 1 deletion cnwebsite/versioned_docs/version-0.63/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ An iOS Alert type.
**常量:**
| Value | 说明 |
| | 说明 |
| ------------------ | ---------------------------- |
| `'default'` | Default alert with no inputs |
| `'plain-text'` | Plain text input alert |
Expand Down
47 changes: 22 additions & 25 deletions patches/@docusaurus+core+2.0.0-alpha.70.patch
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
diff --git a/node_modules/@docusaurus/core/lib/client/prefetch.js b/node_modules/@docusaurus/core/lib/client/prefetch.js
index 3c62adc..172bea4 100644
--- a/node_modules/@docusaurus/core/lib/client/prefetch.js
+++ b/node_modules/@docusaurus/core/lib/client/prefetch.js
@@ -4,6 +4,11 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
+
+
+const cdnUrl = process.env.NODE_ENV === 'development' ?
+ '' : '//cdn.jsdelivr.net/gh/reactnativecn/react-native-website@gh-pages';
+
function support(feature) {
if (typeof document === 'undefined') {
return false;
@@ -61,7 +66,7 @@ function prefetch(url) {
resolve();
return;
}
- supportedPrefetchStrategy(url)
+ supportedPrefetchStrategy(cdnUrl + url)
.then(() => {
resolve();
preFetched[url] = true;
diff --git a/node_modules/@docusaurus/core/lib/webpack/base.js b/node_modules/@docusaurus/core/lib/webpack/base.js
index 567ed59..7a35670 100644
--- a/node_modules/@docusaurus/core/lib/webpack/base.js
+++ b/node_modules/@docusaurus/core/lib/webpack/base.js
@@ -42,6 +42,8 @@ function getDocusaurusAliases() {
return aliases;
}
exports.getDocusaurusAliases = getDocusaurusAliases;
+const cdnUrl =
+ '//cdn.jsdelivr.net/gh/reactnativecn/react-native-website@gh-pages/';
function createBaseConfig(props, isServer, minify = true) {
const { outDir, siteDir, baseUrl, generatedFilesDir, routesPaths } = props;
const totalPages = routesPaths.length;
@@ -58,7 +60,7 @@ function createBaseConfig(props, isServer, minify = true) {
path: outDir,
filename: isProd ? '[name].[contenthash:8].js' : '[name].js',
chunkFilename: isProd ? '[name].[contenthash:8].js' : '[name].js',
- publicPath: baseUrl,
+ publicPath: isProd ? cdnUrl : baseUrl,
},
// Don't throw warning when asset created is over 250kb
performance: {
diff --git a/node_modules/@docusaurus/core/lib/webpack/client.js b/node_modules/@docusaurus/core/lib/webpack/client.js
index cdd914f..fa9ae08 100644
--- a/node_modules/@docusaurus/core/lib/webpack/client.js
Expand Down

0 comments on commit 2c9c58e

Please sign in to comment.