vite icon indicating copy to clipboard operation
vite copied to clipboard

请问如何使用vite打包出来的lib,使用vite打包出来后的lib,css文件会报错。

Open roftLin opened this issue 5 years ago • 4 comments

image vite项目使用vite打包出来后的lib css文件会报错 js不会 不知道怎么办

roftLin avatar Jun 16 '21 06:06 roftLin

I'm not sure if this is a feature(/enhancement) request 🤔 Could you convert it to a discussion or maybe create a bug issue?

Shinigami92 avatar Jun 16 '21 06:06 Shinigami92

Okay I will close this issue now and please open a bug issue and not an enhancement issue Please also respect the issue template

Shinigami92 avatar Jun 17 '21 07:06 Shinigami92

Hi there,@roftLin

I think you need to add the exports field to the package.json file of your vue-component project.

package.json add exports

{
  "exports": {
    ".": {
      "import": "./dist/vue-component.es.js",
      "require": "./dist/vue-component.umd.js"
    },
    "./dist/vue-component.css": {
      "import": "./dist/vue-component.css",
      "require": "./dist/vue-component.css"
    }
  }
}

jekorx avatar Jun 17 '21 08:06 jekorx

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

github-actions[bot] avatar Jul 14 '21 00:07 github-actions[bot]