Merge pull request #12057 from storybookjs/12055-docs-check-fix-absolute-paths

Addon-docs: Fix main check for absolute config dirs
This commit is contained in:
Michael Shilman 2020-08-16 21:23:39 +08:00 committed by GitHub
commit 6bc1e16cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,10 @@ export const verifyDocsBeforeControls = (addons: Entry[]) => {
};
export const ensureDocsBeforeControls = (configDir: string) => {
const mainFile = path.join(process.cwd(), configDir, 'main');
const mainFile = path.isAbsolute(configDir)
? path.join(configDir, 'main')
: path.join(process.cwd(), configDir, 'main');
try {
// eslint-disable-next-line global-require,import/no-dynamic-require
const main = require(mainFile);