diff --git a/core/core/src/modules.ts b/core/core/src/modules.ts index 6258f684c..31a2664ee 100644 --- a/core/core/src/modules.ts +++ b/core/core/src/modules.ts @@ -39,7 +39,6 @@ export const dynamicRequire = (filePath: string): any => { config: { compilerOptions: { jsx: ts.JsxEmit.ReactJSX, - module: ts.ModuleKind.CommonJS, }, }, }; @@ -76,6 +75,7 @@ export const dynamicRequire = (filePath: string): any => { } try { config.config.compilerOptions.outDir = tmpFolder; + config.config.compilerOptions.module = ts.ModuleKind.CommonJS; // moduleResolution option not working delete config.config.compilerOptions['moduleResolution']; delete config.config.compilerOptions['noEmit']; @@ -93,7 +93,8 @@ export const dynamicRequire = (filePath: string): any => { ts.sys.writeFile(fileName, data); }); try { - const result = esmRequire(jsFilePath); + //we are forcing module: commonjs + const result = require(jsFilePath); return result; } catch (e) { error(filePath, e); diff --git a/ui/components/.config/buildtime.js b/ui/components/.config/buildtime.js deleted file mode 100644 index 9e2516647..000000000 --- a/ui/components/.config/buildtime.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - stories: [ - '../src/**/*.stories.tsx', - ], -}; \ No newline at end of file diff --git a/ui/components/.config/buildtime.ts b/ui/components/.config/buildtime.ts new file mode 100644 index 000000000..1d5efde36 --- /dev/null +++ b/ui/components/.config/buildtime.ts @@ -0,0 +1,7 @@ +import { BuildConfiguration } from '@component-controls/core'; + +const config: BuildConfiguration = { + stories: ['../src/**/*.stories.tsx'], +}; + +export default config;