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

View file

@ -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. ",

View file

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