Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get error Module '"vue"' has no exported member 'Component' when unbuild with pnpm #54

Closed
aliuq opened this issue Mar 9, 2022 · 5 comments

Comments

@aliuq
Copy link

aliuq commented Mar 9, 2022

Hi
I used pnpm to run build script, it gots src/index.ts(1,15): error TS2305: Module '"vue"' has no exported member 'Component'.
used npm and yarn are all building works, it seems the issue's reason of pnpm

debug long time…………

I found the issue is relationed with declaration: true config, if declaration value is false, it will build pass, but lost *.d.ts file

can you please help me to analyze it

Thank you.

here is a demo repo

index.ts

import type { Component } from 'vue'

export function Demo(App: Component) {
  return App
}

build.config.ts

import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  entries: [
    { input: 'src/index', name: 'index' },
  ],
  clean: true,
  declaration: true,
  externals: [
    'vue',
  ],
  rollup: {
    emitCJS: true,
  },
})

tsconfig.json

{
  "compilerOptions": {
    "module": "ESNext",
    "target": "es2020",
    "lib": [
      "ESNext",
      "DOM"
    ],
    "esModuleInterop": true,
    "strict": true,
    "strictNullChecks": true,
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "skipLibCheck": true
  },
  "exclude": [
    "**/dist",
    "**/node_modules",
    "**/test"
  ]
}

Error info

image

@action-hong
Copy link

same problem

@aliuq
Copy link
Author

aliuq commented Mar 23, 2022

same problem

You can add .npmrc file on your project. refrenced to vite-ssg

.npmrc

shamefully-hoist = true
ignore-workspace-root-check = true

@action-hong
Copy link

it works thanks

same problem

You can add .npmrc file on your project. refrenced to vite-ssg

.npmrc

shamefully-hoist = true
ignore-workspace-root-check = true

it works, thank you

@danielroe
Copy link
Member

This should be resolved in #57 in the next release.

@aliuq
Copy link
Author

aliuq commented Apr 10, 2022

I test on v0.7.2, it works correct

@aliuq aliuq closed this as completed Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants