mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
feat(core): hash router option - browse site offline (experimental) (#9859)
This commit is contained in:
parent
b73ad1ece5
commit
17f3e02a42
38 changed files with 1018 additions and 266 deletions
|
@ -23,6 +23,7 @@
|
|||
"@babel/core": "^7.23.3",
|
||||
"@babel/preset-env": "^7.23.3",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/theme-translations": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
|
|
|
@ -11,11 +11,14 @@ import WebpackBar from 'webpackbar';
|
|||
import Terser from 'terser-webpack-plugin';
|
||||
import {injectManifest} from 'workbox-build';
|
||||
import {normalizeUrl} from '@docusaurus/utils';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {compile} from '@docusaurus/core/lib/webpack/utils';
|
||||
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
||||
import type {HtmlTags, LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-pwa';
|
||||
|
||||
const PluginName = 'docusaurus-plugin-pwa';
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
||||
function getSWBabelLoader() {
|
||||
|
@ -47,6 +50,7 @@ export default function pluginPWA(
|
|||
outDir,
|
||||
baseUrl,
|
||||
i18n: {currentLocale},
|
||||
siteConfig,
|
||||
} = context;
|
||||
const {
|
||||
debug,
|
||||
|
@ -57,8 +61,15 @@ export default function pluginPWA(
|
|||
swRegister,
|
||||
} = options;
|
||||
|
||||
if (siteConfig.future.experimental_router === 'hash') {
|
||||
logger.warn(
|
||||
`${PluginName} does not support the Hash Router and will be disabled.`,
|
||||
);
|
||||
return {name: PluginName};
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'docusaurus-plugin-pwa',
|
||||
name: PluginName,
|
||||
|
||||
getThemePath() {
|
||||
return '../lib/theme';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue