2021-12-22
1741
#vue
Anthony Gore
83691
Dec 22, 2021 ⋅ 6 min read

Building a Vue 3 component library

Anthony Gore I'm Anthony Gore, a frontend web developer from Sydney, Australia. I curate the weekly Vue.js Developers Newsletter and blog frequently on interesting web development topics.

Recent posts:

podrocket open claw an the ai shift

Open Claw, AI agents, and the future of developer workflows

Paige, Jack, Paul, and Noel dig into the biggest shifts reshaping web development right now, from OpenClaw’s foundation move to AI-powered browsers and the growing mental load of agent-driven workflows.

PodRocket
Mar 2, 2026 ⋅ 47 sec read
knowledge sharing techniques for engineering teams

Why engineering knowledge disappears as teams scale (and how to fight it)

Discover five practical ways to scale knowledge sharing across engineering teams and reduce onboarding time, bottlenecks, and lost context.

Marie Starck
Mar 2, 2026 ⋅ 6 min read
Headless UI Alternatives: Radix Primitives, React Aria, Ark UI

Headless UI alternatives: Radix Primitives vs. React Aria vs. Ark UI vs. Base UI

Check out alternatives to the Headless UI library to find unstyled components to optimize your website’s performance without compromising your design.

Amazing Enyichi Agu
Mar 2, 2026 ⋅ 10 min read

Designing a fully local RAG with small language models setup

A practical guide to building a fully local RAG system using small language models for secure, privacy-first enterprise AI without relying on cloud services.

Rosario De Chiara
Mar 2, 2026 ⋅ 5 min read
View all posts

9 Replies to "Building a Vue 3 component library"

  1. Thanks for sharing, I’ve followed the instructions, but am hitting a “Error: Could not resolve ‘./components’ from src/index.js” when running the `npm run build` command. The ‘/components/’ folder is definitely there.

    If I change the import to “import components from ‘@src/components’ then the build works correctly, however the module then complains, saying “Cannot find module ‘@src/components'” when used as an npm module in a Vue project.

    Any help/advice would be appreciated.

  2. Hello, I am trying to follow your guide. I am encountering an error when trying to build. I have not gotten to publishing yet. It says, “SyntaxError: Cannot use import statement outside a module.” I’ve read some posts suggesting using “type”: “module” but your package.json does not use this. Any advice?

    1. I added type=module to resolve this

      ”’
      {

      “main”: “index.js”,
      “type”: “module”,

      }

  3. Hi Anthony
    Thanks for sharing. This has helped me a lot on something that I currently working
    But I have a problem, I’m working with script setup and because of that I don’t have access to name, inheritAttrs, etc.
    How can I do the iteration through the list of components exported on index.js file?
    For now I added an extra script block where I set the same, but as you can image this is a hackish solution and would like to use on the final product.
    Thanks

  4. this is a really great source. Thanks for this!
    If I want to import the components individually in my project files (ie. import InputText from ‘my-package’) what do I need to do? I tried to add it to the files white-list but no luck

  5. I don’t suppose you could give a little more detail on the vuepress section? I followed the instructions but all I get running the docs server is the 404 page

Leave a Reply

Hey there, want to help make our blog better?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now