UNPKG

993 BJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6const fs_1 = __importDefault(require("fs"));
7const path_1 = __importDefault(require("path"));
8const node_logger_1 = require("@storybook/node-logger");
9function resolveTsConfig(tsConfigPath) {
10 if (fs_1.default.existsSync(tsConfigPath)) {
11 node_logger_1.logger.info('=> Found custom tsconfig.json');
12 return tsConfigPath;
13 }
14 return undefined;
15}
16function default_1(configDir) {
17 const tsLoaderOptions = {
18 transpileOnly: true,
19 compilerOptions: {
20 emitDecoratorMetadata: true,
21 },
22 };
23 const configFilePath = resolveTsConfig(path_1.default.resolve(configDir, 'tsconfig.json'));
24 if (configFilePath)
25 tsLoaderOptions.configFile = configFilePath;
26 return tsLoaderOptions;
27}
28exports.default = default_1;