How can I inject lodash into an application like webpack's provideplugin #2091
-
like _: 'lodash',then I can use anywhere in my project without declaration lodash |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
I have try to set in the define like |
Beta Was this translation helpful? Give feedback.
-
Edit: doesn't work, as You should be able to use esbuild's Something like this:
|
Beta Was this translation helpful? Give feedback.
Edit: doesn't work, as
inject
isn't available in the per-file transform API that Vite uses – however, using a small custom plugin to transform the code does work, see my reply down below: #2091 (reply in thread)You should be able to use esbuild's
inject
option: https://esbuild.github.io/api/#injectSomething like this: