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

feat(tsx): fallback to jiti when missing tsconfig.json #3

Closed

Conversation

userquin
Copy link
Member

@userquin userquin commented May 18, 2024

Description

Check unocss/unocss#3814

Linked Issues

Check linked UnoCSS PR

Additional context

imagen

@johannschopplich
Copy link

johannschopplich commented May 23, 2024

This should be resolved with TSX v4.11.0, specifically commit privatenumber/tsx@b6bf39b.

Also, with the latest release, tsconfig lookup can be disabled (privatenumber/tsx@3f42ae3):

tsImport('./file.ts', {
    parentURL: import.meta.url,
    tsconfig: false
})

So for Nuxt context, we can disable tsconfig lookup manually, right? 🤔

const mod = await r.import(path, {
  parentURL: nuxt.options.rootDir,
  loaderOptions: {
    tsx: { tsconfig: false }
  },
})

@userquin
Copy link
Member Author

userquin commented May 23, 2024

Not easy, we should provide the option to the consumer on every lib using importx, I dont like this behavior.

About nuxt, how do you know in unocss config package you are executing pnpm nuxi prepare first time (.nuxt folder)?.

@johannschopplich
Copy link

johannschopplich commented May 23, 2024

@userquin I feel you. But with the latest changes in tsx, the import won't fail anymore if no tsconfig.json was explicitly set via the config. Thus, even without passing the option tsconfig: false down from importx to tsx, it won't throw an error anymore. (getTsconfig is now wrapped in try/catch.) So with tsx v4.11+, it will just work in a Nuxt context.

@userquin
Copy link
Member Author

userquin commented May 23, 2024

superseded by #4

thx @johannschopplich ❤️

@userquin userquin closed this May 23, 2024
@userquin userquin deleted the feat-missing-tsconfig branch May 23, 2024 16:14
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

Successfully merging this pull request may close these issues.

None yet

2 participants