끄적끄적

[VUE] vue-sfc-rollup로 npm 패키지 만들기 본문

Front-end/Vue.js

[VUE] vue-sfc-rollup로 npm 패키지 만들기

mashko 2021. 6. 25. 23:52
반응형

먼저 버전에 문제가 있을수 있으니 nvm을 통해 최신버전으로 변경해 주세요.
https://nodejs.org/ko/

nvm install v14.17.1

vue-sfc-rollup 설치

npm install -g vue-sfc-rollup

sfc-init 실행

$ sfc-init
✔ Which version of Vue are you writing for? › Vue 2
✔ Is this a single component or a library? › Library
✔ What is the npm name of your library? … ts-class-enum
✔ Will this library be written in JavaScript or TypeScript? › TypeScript
✔ Enter a location to save the library files: … ./ts-class-enum

  Init is complete, your files have been generated and saved into the directory you specified above.
  Within that directory, you will find a sample SFC at src/lib-components/ts-class-enum-sample.vue.
  **NOTE** Any components you wish to expose as part of your library should be saved in that directory, and
  an entry must be added to src/lib-components/index.ts and ts-class-enum.d.ts so rollup is aware of it
  and typescript users can receive proper support.
  When you're ready, run npm run build to generate the redistributable versions.

폴더 이동 후 npm install실행

npm i

콤포넌트 또는 라이브러리 구현

npm run build 실행

관련 URL
https://www.npmjs.com/package/vue-sfc-rollup

반응형
Comments