Skip to content

Building modules (lib) with Vite + Vue3 + Typescript fails #2443

@holtwick

Description

@holtwick

Describe the bug

Building a module with Vite fails when the final product is built (vite build). But it works in developer preview (vite).

Reproduction

  1. Create a Vue3+TS module as described in https://vitejs.dev/guide/build.html#library-mode
  2. Build for distribution with npm run build
  3. Use it in another Vite+Vue3+TS project

Sample project:
sample.zip

How to use:

  1. Go into /lib and call: npm install && npm run build
  2. Go into /main and call: npm install && npm run build && npm run serve

Expected: See output from lib component.

Actual: No output, but console output from same component shows up. Also works in dev mode, try npm run dev.

System Info

  • vite version: 2.0.5
  • Operating System: macOS M1 11.2.3
  • Node version: v15.11.0 (brew)
  • Package manager (npm/yarn/pnpm) and version: 7.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions