mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 10:48:05 +02:00
Enable isolatedModules: true
This commit is contained in:
parent
848621e079
commit
e656c350dd
2 changed files with 16 additions and 11 deletions
|
@ -11,19 +11,23 @@
|
|||
// TODO this is not ideal and produce a warning!
|
||||
// see https://github.com/webpack/webpack/issues/7713#issuecomment-467888437
|
||||
// note: warning can be filtered: https://github.com/facebook/docusaurus/pull/3382#issuecomment-684966924
|
||||
try {
|
||||
// eslint-disable-next-line global-require
|
||||
module.exports = require('@theme-init/hooks/useDocs');
|
||||
} catch (e) {
|
||||
// In case the docs plugin is not available, might be useful to stub some methods here
|
||||
// https://github.com/facebook/docusaurus/issues/3947
|
||||
const Empty = {};
|
||||
module.exports = {
|
||||
useAllDocsData: () => Empty,
|
||||
useActivePluginAndVersion: () => undefined,
|
||||
};
|
||||
function getExport() {
|
||||
try {
|
||||
// eslint-disable-next-line global-require
|
||||
return require('@theme-init/hooks/useDocs');
|
||||
} catch (e) {
|
||||
// In case the docs plugin is not available, might be useful to stub some methods here
|
||||
// https://github.com/facebook/docusaurus/issues/3947
|
||||
const Empty = {};
|
||||
return {
|
||||
useAllDocsData: () => Empty,
|
||||
useActivePluginAndVersion: () => undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default getExport();
|
||||
|
||||
/*
|
||||
throw new Error(
|
||||
"The docs plugin is not used, so you can't require the useDocs hooks. ",
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
"moduleResolution": "node",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
|
||||
/* Advanced Options */
|
||||
"resolveJsonModule": true,
|
||||
|
|
Loading…
Add table
Reference in a new issue