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

allowImportingTsExtensions error when creating/building project #208

Closed
Merlin04 opened this issue Jan 4, 2024 · 5 comments
Closed

allowImportingTsExtensions error when creating/building project #208

Merlin04 opened this issue Jan 4, 2024 · 5 comments

Comments

@Merlin04
Copy link

Merlin04 commented Jan 4, 2024

Current Behavior

If I run npx dts-cli create hackend-frontend and choose to create a React library, the dts build step at the end of the process (and running that command manually) causes this error:

RollupError: error TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.

I tried setting allowImportingTsExtensions to false in both tsconfigs (library and example) but I still get that error when trying to build.

Your environment

  System:
    OS: Linux 6.6 openSUSE Tumbleweed 20231226
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P
    Memory: 21.11 GB / 46.76 GB
    Container: Yes
    Shell: 0.14.1 - /usr/bin/xonsh
  Binaries:
    Node: 21.4.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.4 - /usr/bin/npm
    pnpm: 8.14.0 - /usr/local/bin/pnpm
    bun: 1.0.11 - ~/.bun/bin/bun
    Watchman: 4.9.0 - /usr/bin/watchman
  Browsers:
    Chromium: 119.0.6045.199
  npmPackages:
    dts-cli: ^2.0.3 => 2.0.3 
    typescript: ^5.3.3 => 5.3.3
@aladdin-add
Copy link

seems it was added in the new vite-react release, you can just add the config in your tsconfig.json:

  "compilerOptions": {
    "allowImportingTsExtensions": false
  },

@aladdin-add
Copy link

it was resolved by adding the config on my macos. can you provide a repro if not, thanks! 🙏

@osbornm
Copy link

osbornm commented Jan 8, 2024

@aladdin-add turning off that setting generates the following error:

node_modules/@types/react/index.d.ts:32:1
    32 export = React;
       ~~~~~~~~~~~~~~~
    This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

to repo simply run npx dts-cli create my-lib then try to build my-lib using npm run build

@aladdin-add
Copy link

@osbornm I was not able to repro🤔.

I have pushed a new release. please provide a repro if you still encountered it, thanks! 🙏

@osbornm
Copy link

osbornm commented Jan 9, 2024

@aladdin-add still happens using react-with-storybook option
Screenshot 2024-01-09 at 9 03 24 AM

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

3 participants