Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript version of the config file (dts.config.ts) throws an error when running build #207

Open
lukasbals opened this issue Nov 30, 2023 · 0 comments

Comments

@lukasbals
Copy link

Current Behavior

When I use a dts.config.ts (Typescript version of the config file) with the following contents (same as in the example in the readme):

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.
  },
});

I get the following error when running npm run build (dts build):

Error: Cannot find module 'dts-cli'
Require stack:
- /Users/lukasbals/treely/strapi-slices/dts.config.ts
- /Users/lukasbals/treely/strapi-slices/node_modules/dts-cli/dist/createBuildConfigs.js
- /Users/lukasbals/treely/strapi-slices/node_modules/dts-cli/dist/index.js

    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/lukasbals/treely/strapi-slices/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/Users/lukasbals/treely/strapi-slices/dts.config.ts:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module.m._compile (/Users/lukasbals/treely/strapi-slices/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/lukasbals/treely/strapi-slices/node_modules/ts-node/src/index.ts:1621:12)

Expected behavior

The build starts.

Suggested solution(s)

Additional context

Your environment

  System:
    OS: macOS 14.1.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 64.41 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.2.4 - ~/treely/strapi-slices/node_modules/.bin/npm
  Browsers:
    Chrome: 119.0.6045.199
    Safari: 17.1
  npmPackages:
    dts-cli: ^2.0.3 => 2.0.3
    typescript: ^5.3.2 => 5.3.2
  npmGlobalPackages:
    dts-cli: 2.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant