diff --git a/src/fetchers/body.ts b/src/fetchers/body.ts index 3356953..44438e5 100644 --- a/src/fetchers/body.ts +++ b/src/fetchers/body.ts @@ -1,4 +1,4 @@ -import FormData = require('form-data'); +import FormData from 'form-data'; import { FetcherOptions } from '@/fetchers/types'; diff --git a/tsconfig.json b/tsconfig.json index d3fea2f..4ea9f0b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "target": "es2021", "lib": ["es2021"], - "module": "commonjs", + "module": "CommonJS", + "esModuleInterop": true, "declaration": true, "outDir": "./lib", "strict": true, diff --git a/vite.config.js b/vite.config.js index d3f922b..78ab49d 100644 --- a/vite.config.js +++ b/vite.config.js @@ -2,6 +2,7 @@ const path = require('path'); const { defineConfig } = require('vitest/config'); const { default: eslint } = require('vite-plugin-eslint'); const dts = require('vite-plugin-dts'); +const pkg = require('./package.json'); const main = path.resolve(__dirname, 'src/index.ts'); @@ -14,12 +15,19 @@ module.exports = defineConfig({ }, build: { minify: false, + rollupOptions: { + external: Object.keys(pkg.dependencies), + output: { + globals: Object.fromEntries(Object.keys(pkg.dependencies).map((v) => [v, v])), + }, + }, outDir: 'lib', lib: { entry: main, name: 'index', fileName: 'index', + formats: ['umd', 'es'], }, }, });