You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case where in a Vite plugin (or in vite.config.ts), I'd like to import some code that uses imports with aliases. resolve.alias does not seem to work, I'm guessing because it only applies to code running in the browser but plugins run in node.
I tried using https://github.com/ilearnio/module-alias (example) but no luck so far (SyntaxError: Cannot use import statement outside a module error appears, like on this issue). Is something like this feasible, and how ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a use case where in a Vite plugin (or in
vite.config.ts
), I'd like to import some code that uses imports with aliases.resolve.alias
does not seem to work, I'm guessing because it only applies to code running in the browser but plugins run in node.I tried using https://github.com/ilearnio/module-alias (example) but no luck so far (
SyntaxError: Cannot use import statement outside a module
error appears, like on this issue). Is something like this feasible, and how ?Thanks a lot.
Beta Was this translation helpful? Give feedback.
All reactions