Supporting Webpack with a Vite TS Library #18710
Unanswered
haoshuai-mis
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I think you have wrong paths somewhere |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Vanilla TypeScript library that uses Vite similar to the starter library project. I'm trying to install it into an Angular application that uses
@angular-devkit/build-angular:browser
, which builds with Webpack, I get a module not found error for anything exported from my TS library. If I try any other Webpack applications, I get a similar result.For example, if I try installing that starter library project into a Webpack boilerplate and importing sum(), I get the following error:
I take it that the module is not being found because Webpack does not support the ESM format that Vite is building. Where I get lost is how to configure my
vite.config.ts
andtsconfig.json
to support Webpack — if that is at all possible. If I try switching my output to cjs, it doesn't seem to make much of a difference. Are there any guides/examples of how to make Vite libraries work with Webpack?And before you ask: yes I'm stuck with supporting said Angular projects set to
@angular-devkit/build-angular:browser
.Beta Was this translation helpful? Give feedback.
All reactions