diff --git a/example/node_modules/@vue/compiler-sfc/package.json b/example/node_modules/@vue/compiler-sfc/package.json deleted file mode 100644 index 9b08d88..0000000 --- a/example/node_modules/@vue/compiler-sfc/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "../../../../node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs" -} diff --git a/package.json b/package.json index 15a3a39..996b169 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "url": "git+https://github.com/qmhc/vite-plugin-dts.git" }, "scripts": { - "build": "tsup src/index.ts --dts --format cjs,esm", + "build": "tsup src/index.ts --dts --format cjs,esm --external @vue/compiler-sfc", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .", "dev": "yarn run build -- --watch", "lint": "eslint --fix --ext .js,.ts src/**", diff --git a/src/index.ts b/src/index.ts index b5a17f6..53fd595 100644 --- a/src/index.ts +++ b/src/index.ts @@ -159,7 +159,7 @@ export default (options: PluginOptions = {}): Plugin => { const requireCompiler = () => { if (!compiler) { try { - compiler = require(resolve('node_modules/@vue/compiler-sfc')) + compiler = require('@vue/compiler-sfc') } catch (e) { throw new Error('@vue/compiler-sfc is not present in the dependency tree.\n') }