diff --git a/dist/index.js b/dist/index.js index 2eb23eb2503d534e36c40f0578ced4d904960418..fa1029452dd0155d7af0cb6585cd9e1b6c135e1e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,14 +1,8 @@ import { defineConfig } from "vite"; import { externalizeDeps } from "vite-plugin-externalize-deps"; import tsconfigPaths from "vite-tsconfig-paths"; -import dts from "vite-plugin-dts"; //#region src/index.ts -function ensureImportFileExtension({ content, extension }) { - content = content.replace(/(im|ex)port\s[\w{}/*\s,]+from\s['"](?:\.\.?\/)+?[^.'"]+(?=['"];?)/gm, `$&.${extension}`); - content = content.replace(/import\(['"](?:\.\.?\/)+?[^.'"]+(?=['"];?)/gm, `$&.${extension}`); - return content; -} const tanstackViteConfig = (options) => { const outDir = options.outDir ?? "dist"; const cjs = options.cjs ?? true; @@ -20,63 +14,10 @@ const tanstackViteConfig = (options) => { except: options.bundledDeps ?? [] }), options.tsconfigPath ? tsconfigPaths({ projects: [options.tsconfigPath] }) : void 0, - dts({ - outDir: `${outDir}/esm`, - entryRoot: options.srcDir, - include: options.srcDir, - exclude: options.exclude, - tsconfigPath: options.tsconfigPath, - compilerOptions: { - module: 99, - declarationMap: false - }, - beforeWriteFile: (filePath, content) => { - content = options.beforeWriteDeclarationFile?.(filePath, content) || content; - return { - filePath, - content: ensureImportFileExtension({ - content, - extension: "js" - }) - }; - }, - afterDiagnostic: (diagnostics) => { - if (diagnostics.length > 0) { - console.error("Please fix the above type errors"); - process.exit(1); - } - } - }), - cjs ? dts({ - outDir: `${outDir}/cjs`, - entryRoot: options.srcDir, - include: options.srcDir, - exclude: options.exclude, - tsconfigPath: options.tsconfigPath, - compilerOptions: { - module: 100, - declarationMap: false - }, - beforeWriteFile: (filePath, content) => { - content = options.beforeWriteDeclarationFile?.(filePath, content) || content; - return { - filePath: filePath.replace(".d.ts", ".d.cts"), - content: ensureImportFileExtension({ - content, - extension: "cjs" - }) - }; - }, - afterDiagnostic: (diagnostics) => { - if (diagnostics.length > 0) { - console.error("Please fix the above type errors"); - process.exit(1); - } - } - }) : void 0 ], build: { outDir, + emptyOutDir: false, minify: false, sourcemap: true, lib: { @@ -94,4 +35,3 @@ const tanstackViteConfig = (options) => { //#endregion export { tanstackViteConfig }; \ No newline at end of file -//# sourceMappingURL=index.js.map