From f3720a665ea28624e15c06998a4881affec6091b Mon Sep 17 00:00:00 2001 From: Novout Date: Sat, 4 Feb 2023 14:28:04 -0300 Subject: [PATCH] refactor(pdf)!: some improvements --- README.md | 8 +- build.config.ts | 34 +- demo/src/App.vue | 7 +- demo/src/main.js | 4 +- package.json | 33 +- pnpm-lock.yaml | 2249 ++++++++++++++++++++++++++++++++++++++++++++ src/index.ts | 5 +- src/plugin.ts | 4 +- yarn.lock | 2337 ---------------------------------------------- 9 files changed, 2289 insertions(+), 2392 deletions(-) create mode 100644 pnpm-lock.yaml delete mode 100644 yarn.lock diff --git a/README.md b/README.md index 05a2a1f..4600898 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,12 @@ in `main.(js|ts)` ```js import { createApp } from 'vue'; -import pdfMake from 'vue3-pdfmake'; +import { PDFPlugin } from 'vue3-pdfmake'; import App from './App.vue'; const app = createApp(App); //... -app.use(pdfMake); +app.use(PDFPlugin); //... app.mount('#app'); ``` @@ -40,6 +40,4 @@ app.mount('#app'); pdf.createPdf({}).download(); }); -``` - -> WARNING: Depending on how the instance was initialized, use `const pdf = usePDF().default` instead `const pdf = usePDF()` \ No newline at end of file +``` \ No newline at end of file diff --git a/build.config.ts b/build.config.ts index fc47783..6e56776 100644 --- a/build.config.ts +++ b/build.config.ts @@ -1,23 +1,13 @@ -export default { - entries: [ - { - input: 'src/index.ts', - outDir: 'dist', - name: 'index', - format: 'esm', - ext: 'mjs', +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + entries: [ + './src/index', + ], + rollup: { + emitCJS: true, }, - { - input: 'src/index.ts', - outDir: 'dist', - name: 'index', - format: 'cjs', - ext: 'cjs', - }, - ], - rollup: { - emitCJS: true, - }, - declaration: true, - externals: ['pdfmake'], -} \ No newline at end of file + clean: true, + declaration: true, + externals: ['pdfmake'], +}) \ No newline at end of file diff --git a/demo/src/App.vue b/demo/src/App.vue index f99e693..1331864 100644 --- a/demo/src/App.vue +++ b/demo/src/App.vue @@ -1,8 +1,4 @@