Enable isolatedModules: true

This commit is contained in:
slorber 2021-05-13 20:10:41 +02:00
parent 848621e079
commit e656c350dd
2 changed files with 16 additions and 11 deletions
packages/docusaurus-theme-classic/src/theme/hooks
tsconfig.json

View file

@ -11,19 +11,23 @@
// TODO this is not ideal and produce a warning! // TODO this is not ideal and produce a warning!
// see https://github.com/webpack/webpack/issues/7713#issuecomment-467888437 // see https://github.com/webpack/webpack/issues/7713#issuecomment-467888437
// note: warning can be filtered: https://github.com/facebook/docusaurus/pull/3382#issuecomment-684966924 // note: warning can be filtered: https://github.com/facebook/docusaurus/pull/3382#issuecomment-684966924
try { function getExport() {
try {
// eslint-disable-next-line global-require // eslint-disable-next-line global-require
module.exports = require('@theme-init/hooks/useDocs'); return require('@theme-init/hooks/useDocs');
} catch (e) { } catch (e) {
// In case the docs plugin is not available, might be useful to stub some methods here // In case the docs plugin is not available, might be useful to stub some methods here
// https://github.com/facebook/docusaurus/issues/3947 // https://github.com/facebook/docusaurus/issues/3947
const Empty = {}; const Empty = {};
module.exports = { return {
useAllDocsData: () => Empty, useAllDocsData: () => Empty,
useActivePluginAndVersion: () => undefined, useActivePluginAndVersion: () => undefined,
}; };
}
} }
export default getExport();
/* /*
throw new Error( throw new Error(
"The docs plugin is not used, so you can't require the useDocs hooks. ", "The docs plugin is not used, so you can't require the useDocs hooks. ",

View file

@ -28,6 +28,7 @@
"moduleResolution": "node", "moduleResolution": "node",
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
"isolatedModules": true,
/* Advanced Options */ /* Advanced Options */
"resolveJsonModule": true, "resolveJsonModule": true,