1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | const fs_1 = __importDefault(require("fs"));
|
7 | const path_1 = __importDefault(require("path"));
|
8 | const node_logger_1 = require("@storybook/node-logger");
|
9 | function 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 | }
|
16 | function 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 | }
|
28 | exports.default = default_1;
|