After using npx dts-cli create test[1-3] with all cases (basic, react, react with storybook), I noticed that react with storybook does not build at all out of the box (#212), and none of them will build after adding the dts.config.ts file from the configuration section with this error:
Error: Cannot find module 'dts-cli'
Require stack:
- C:\Users\_\repos\test1\dts.config.ts
- C:\Users\_\repos\test1\node_modules\dts-cli\dist\createBuildConfigs.js
- C:\Users\_\repos\test1\node_modules\dts-cli\dist\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\_\repos\test1\node_modules\@cspotcode\source-map-support\source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:901:27)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (C:\Users\_\repos\test1\dts.config.ts:1:1)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module.m._compile (C:\Users\_\repos\test1\node_modules\ts-node\src\index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\_\repos\test1\node_modules\ts-node\src\index.ts:1621:12)
Here is the original dts.config.ts file:
import { defineConfig } from 'dts-cli';
export default defineConfig({
// This function will run for each entry/format/env combination
rollup: (config, options) => {
return config; // always return a config.
},
});
After adjusting the dts.config.ts file from export default defineConfig({...}) to module.exports = defineConfig({...}), the same error occurs. Finally, changing the syntax to module.exports = {...} allows all 3 to build properly (react with storybook needed some other changes in tsconfig.json first [#212]).
Expected behavior
Ideally: Any of these methods of exporting should work correctly
At least: It should be made clear that only module.exports = {...} will function
Suggested solution(s)
Presumably this is an issue with the code that merges these files, or maybe defineConfig itself. I assume adjusting one of these would allow it to handle different export methods
Current Behavior
After using
npx dts-cli create test[1-3]
with all cases (basic, react, react with storybook), I noticed thatreact with storybook
does not build at all out of the box (#212), and none of them will build after adding the dts.config.ts file from the configuration section with this error:Here is the original
dts.config.ts
file:After adjusting the
dts.config.ts
file fromexport default defineConfig({...})
tomodule.exports = defineConfig({...})
, the same error occurs. Finally, changing the syntax tomodule.exports = {...}
allows all 3 to build properly (react with storybook needed some other changes intsconfig.json
first [#212]).Expected behavior
Ideally: Any of these methods of exporting should work correctly At least: It should be made clear that only
module.exports = {...}
will functionSuggested solution(s)
Presumably this is an issue with the code that merges these files, or maybe
defineConfig
itself. I assume adjusting one of these would allow it to handle different export methodsAdditional context
None
Your environment