diff --git a/scripts/tasks/sandbox.ts b/scripts/tasks/sandbox.ts index 24b946049631..117d10948b51 100644 --- a/scripts/tasks/sandbox.ts +++ b/scripts/tasks/sandbox.ts @@ -25,12 +25,24 @@ export const sandbox: Task = { return pathExists(sandboxDir); }, async run(details, options) { - if (options.link && details.template.inDevelopment) { - logger.log( - `The ${options.template} has inDevelopment property enabled, therefore the sandbox for that template cannot be linked. Enabling --no-link mode..` - ); - // eslint-disable-next-line no-param-reassign - options.link = false; + if (options.link) { + if (details.template.expected.framework === '@storybook/angular') { + // In Angular, tsc is spawn via Webpack and for some reason it follows the symlinks and doesn’t recognize it as node_modules. Hence, it does type checking on regular files. + // Angular's tsconfig compilerOptions are more strict than the ones in the mono-repo and results in many errors, therefore we use --no-link to circumvent them. + logger.log( + `Detected an Angular sandbox, which cannot be linked. Enabling --no-link mode..` + ); + // eslint-disable-next-line no-param-reassign + options.link = false; + } + + if (details.template.inDevelopment) { + logger.log( + `The ${options.template} has inDevelopment property enabled, therefore the sandbox for that template cannot be linked. Enabling --no-link mode..` + ); + // eslint-disable-next-line no-param-reassign + options.link = false; + } } if (await this.ready(details)) { logger.info('🗑 Removing old sandbox dir');