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

[Feature]: Add override for noEmit specified in TSConfig #5770

Open
kripod opened this issue May 25, 2024 · 7 comments
Open

[Feature]: Add override for noEmit specified in TSConfig #5770

kripod opened this issue May 25, 2024 · 7 comments

Comments

@kripod
Copy link

kripod commented May 25, 2024

What problem does this feature solve?

When using Modern.js alongside @total-typescript/tsconfig, noEmit: false has to be specified explicitly within tsconfig.json, otherwise modern build fails:

error   ModuleBuildError: 

bundleless DTS failed:

error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.

Unfortunately, though, when I have noEmit: false specified (either implicitly or explicitly) alongside allowJs: true, IDEs like VS Code show an error message as follows when viewing tsconfig.json while having any JS files within the source directory:

Cannot write file '…/project/src/something.js' because it would overwrite input file.

Therefore, it’d be convenient to allow specifying noEmit: true within the userTsconfig, possibly overriding it by appending --noEmit false to the CLI arguments over here.

What does the proposed API look like?

N/A

@yimingjfe
Copy link
Member

Could you provide the project? Because we don't know which tsconfig from @total-typescript/tsconfig you are using, and is app-tools or module-tools used in the project?

@kripod kripod closed this as completed May 28, 2024
@kripod kripod reopened this May 28, 2024
@kripod
Copy link
Author

kripod commented May 28, 2024

Thanks for your response!

Unfortunately, I can’t provide the project itself, as it’s a private one. This is the TSConfig I’m using.

@yimingjfe
Copy link
Member

yimingjfe commented May 28, 2024

Thanks for your response!

Unfortunately, I can’t provide the project itself, as it’s a private one. This is the TSConfig I’m using.

Understand, what library are you using? @modern-js/app-tools or @modern-js/module-tools?

@kripod
Copy link
Author

kripod commented May 28, 2024

@modern-js/module-tools, but I also gave Vite’s library mode a go in the meantime and sticked with it for the time being.

@yimingjfe
Copy link
Member

I created a project as described to try to reproduce the problem, but it didn't reproduce the problem.

@kripod
Copy link
Author

kripod commented Jun 1, 2024

Thanks for creating that!

I forgot to mention I had 'npm-component-es2017' configured as the buildPreset in modern.config.ts. Running your project with that change results in a reproduction.

@fi3ework
Copy link
Member

fi3ework commented Jun 5, 2024

Thanks for creating that!

I forgot to mention I had 'npm-component-es2017' configured as the buildPreset in modern.config.ts. Running your project with that change results in a reproduction.

Can't reproduce the error even adding 'npm-componnet-es2017', the error seems quite like a pure TypeScript misconfiguration, could you check your tsconfig by refering https://stackoverflow.com/a/48798945/8063488.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants