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

I want vite build lib/app support out not bundle js,d.ts. #9629

Closed
4 tasks done
lamianbu opened this issue Aug 11, 2022 · 5 comments
Closed
4 tasks done

I want vite build lib/app support out not bundle js,d.ts. #9629

lamianbu opened this issue Aug 11, 2022 · 5 comments

Comments

@lamianbu
Copy link

lamianbu commented Aug 11, 2022

Description

As a Web Components UI Lib developer using Vite,I want Vite support out not bundle js,d.ts.

Because I want UI Lib componets and utils is not bundle es module.

if vite build app support out not bundle js,d.ts,it is more ok,my demo project with lib, no need lib config

Suggested solution

vite build --nobundle

Alternative

No response

Additional context

No response

Validations

@lamianbu lamianbu changed the title I want Vite support out not bundle js,d.ts. I want vite build support out not bundle js,d.ts. Aug 11, 2022
@lamianbu lamianbu changed the title I want vite build support out not bundle js,d.ts. I want vite build lib/app support out not bundle js,d.ts. Aug 11, 2022
@sapphi-red
Copy link
Member

Would you add a example of input files and output files? Maybe you are looking for #4530 or preserveModules.

@lamianbu
Copy link
Author

yes, preserveModules. support out not bundle js.

But how to make d.ts?

@petermekhaeil
Copy link
Contributor

Vite uses esbuild to transpile Typescript into Javascript and esbuild does not do any type checking nor declaration output. You'll need to do that in an additional step:

@lamianbu
Copy link
Author

lamianbu commented Aug 15, 2022

yeah ,I find two way can support d.ts:

  1. rollup preserveModules + vite-plugin-dts
  2. rollup preserveModules + tsc --declaration --emitDeclarationOnly

vite-plugin-dts can work on app mode, not only on lib mode.

@sapphi-red
Copy link
Member

Closing as this is solved.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants