Skip to content

Commit

Permalink
fix: support require for cjs exports
Browse files Browse the repository at this point in the history
fix #39
  • Loading branch information
qmhc committed Nov 3, 2021
1 parent 60d7d69 commit cc5aff9
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 388 deletions.
4 changes: 2 additions & 2 deletions example/vite.config.ts
Expand Up @@ -2,7 +2,7 @@ import { resolve } from 'path'
import { existsSync, readdirSync, lstatSync, rmdirSync, unlinkSync } from 'fs'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import dts from '../src'
import { dtsPlugin } from '../src/plugin'

emptyDir(resolve(__dirname, 'types'))

Expand All @@ -26,7 +26,7 @@ export default defineConfig({
}
},
plugins: [
dts({
dtsPlugin({
outputDir: 'types',
// include: ['src/index.ts'],
exclude: ['src/ignore'],
Expand Down
2 changes: 1 addition & 1 deletion src/compile.ts
Expand Up @@ -4,7 +4,7 @@ const exportDefaultRE = /export\s+default/
const exportDefaultClassRE = /(?:(?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/

let index = 1
let compiler: typeof import('@vue/compiler-sfc')
let compiler: typeof import('vue/compiler-sfc')

function requireCompiler() {
if (!compiler) {
Expand Down

0 comments on commit cc5aff9

Please sign in to comment.