Linked ESM package not found
I am trying to import from a linked package that I've built with vite (in library mode).
When I try to run the dev script, I get:
Failed to load url /@fs/Users/david.marr/code/ui-components/packages/Utils/lib/index.mjs (resolved id: /Users/david.marr/code/ui-components/packages/Utils/lib/index.mjs) in /Users/david.marr/code/app/src/plugins/filters.js. Does the file exist?I don't have type: 'module' in either the app or the package i'm trying to import. I've linked the package and verified that it is in node_modules. Not sure what the issue is... If I run the
build
script, the issue doesn't appear. I also am able to import this package in a fresh nuxt 3 app, so maybe there is something with linking that is the issue?18 Replies
seems like i'm required to use
.ts
extension and lang="ts"
in my vue files
well removing my old jsconfig.json seems to get past that, but now I get the same error on a vue fileUnknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
so in package's package.json:
in the lib/ dir, the
index.mjs
file is present
would having a jsconfig.json
file impact anything? I'm trying to narrow down why a clean nuxt3 project can import just fine, but my nuxt2->nuxt3 upgrade cannot
appears I need to add to vite
config in nuxt.config.js:
Vite
Next Generation Frontend Tooling
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
yeah i tried both. i think something about the package being linked was causing issues
Unknown Userβ’17mo ago
Message Not Public
Sign In & Join Server To View
Hi, I havent found a solution. I ended up starting a new monorepo and I'm moving things over π¦
Unknown Userβ’17mo ago
Message Not Public
Sign In & Join Server To View
ok thanks. I was playing around with the vite section of nuxt config.
i don't know why but it seemed to get past some errors, but something with the way my external package (using vite lib mode) was built that nuxt didn't like
the other crappy workaround was
npm pack
in the external package and installing from thatUnknown Userβ’17mo ago
Message Not Public
Sign In & Join Server To View
maybe transpile it
Unknown Userβ’17mo ago
Message Not Public
Sign In & Join Server To View
Thank you @Nobsow -- good work! I will give it a try today
Unknown Userβ’17mo ago
Message Not Public
Sign In & Join Server To View