Closed gabsdotco closed 1 year ago
You're not missing anything, this is the correct behavior. The alias
option is meant for aliasing specific modules, such as react
-> preact/compat
, not as a mechanism to support absolute imports (and I'd highly recommend against them anyhow).
You could use Microbundle's JS API if you really wanted to do this, but for now, this is working as intended.
Hey @rschristian, thanks for the answer. I managed to solve it by using Babel's Module Resolver plugin, now I can define aliases on babel.config.js
and everything works great.
Cheers!
Hey there,
I'm currently running a Firebase Functions project using Microbundle and I'm changing all my relative imports to absolute imports, using the
@/*
pattern.I saw that Microbundle has an
--alias
flag, but it only works when I define a specific path alias, likemicrobundle build ... --alias @/loaders/firebase=$PWD/src/loaders/firebase
, it doesn't see to work with an alias like--alias @/=$PWD/src
or--alias @/*=$PWD/src/*
. Am I missing something?My current code with the absolute import:
As I said it only works with
--alias @/loaders/firebase=$PWD/src/loaders/firebase
, all the other alias show the following error message:I would like to set only one alias that can point to all folders within
./src
.