vitejs / vite

Next generation frontend tooling. It's fast!
http://vitejs.dev
MIT License
66.36k stars 5.93k forks source link

Is it possible to use vite to build a component library ? #523

Closed svieujot closed 4 years ago

svieujot commented 4 years ago

With someting like vite build --target lib --name my-components

With the following package.json,

{
  "name": "vue-components",
  "version": "0.0.0",
  "license": "SEE LICENSE IN /LICENSE.md",
  "private": true,
  "scripts": {
    "build": "vite build --target lib --name my-components"
  },
  "dependencies": {
    "vue": "^3.0.0-beta.18",
    "vue-qrcode-reader": "^2.3.1"
  },
  "devDependencies": {
    "@vue/compiler-sfc": "^3.0.0-beta.18",
    "vite": "^1.0.0-beta.11"
  }
}

I get:

$ npm run build

> vue-components@0.0.0 build /home/sylvain/git/com.seanergie.java.intranet/src/main/javascript
> vite build --target lib --name my-components

vite v1.0.0-beta.11
⠹ Building for production...
[vite] Build errored out.
Error: Could not resolve entry module (index.html).
    at error (/home/sylvain/git/com.seanergie.java.intranet/src/main/javascript/node_modules/rollup/dist/shared/rollup.js:5171:30)
    at ModuleLoader.loadEntryModule (/home/sylvain/git/com.seanergie.java.intranet/src/main/javascript/node_modules/rollup/dist/shared/rollup.js:17874:16)
    at async Promise.all (index 0) {
  code: 'UNRESOLVED_ENTRY'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-components@0.0.0 build: `vite build --target lib --name my-components`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vue-components@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sylvain/.npm/_logs/2020-07-06T07_58_32_920Z-debug.log
 sylvain  …  src  main  javascript  
m4rvr commented 4 years ago

No but there is already an enhancement issue #330

svieujot commented 4 years ago

I will follow this.

Thank you.