#Import Components from NPM

8 messages · Page 1 of 1 (latest)

high spear
#

Hey everyone 👋

A few days ago, I asked about npm starters for building reusable components, and luckily, the community was super helpful. 🙌 Here's the thread for reference: #feedback-ideas message

I ended up using the Astro component boilerplate, and everything has been great so far. However, I've run into an issue: I'm trying to export two components from the same "url" (or package), and it's not working as expected. Has anyone encountered this before or knows how to solve it?

Appreciate your help in advance astronauts! 🚀

upper forum
#

Could you share some higher-res pictures or the code itself? It's pretty much unreadable on my end

#

And while you're at it, can you share your package.json file? The export needs to be specified there too

high spear
#

sure @upper forum !

import ButtonLink from "./src/components/button_link/Index.astro";

export { Asset, ButtonLink };

that is index.ts

{
  "name": "@terrahq/astro-core",
  "private": false,
  "version": "0.0.1",
  "type": "module",
  "exports": {
    ".": "./index.ts"
  },
  "files": [
    "src",
    "index.ts"
  ],
  "keywords": [
    "astro-component"
  ],
  "scripts": {},
  "devDependencies": {
    "astro": "^4.16.12"
  },
  "peerDependencies": {
    "astro": "^4.0.0"
  }
}

package.json ^

#

component works but it has that underline

upper forum
#

Interesting, the exports look correct

#

Have you tried restarting VSCode / the Extension Host?

high spear
#

nope, but will def give it a try.