more working

This commit is contained in:
EthanShoeDev
2025-09-18 02:27:05 -04:00
parent 8cb3a7528a
commit d664dc26c0
12 changed files with 251 additions and 119 deletions

View File

@@ -1,8 +1,11 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import fs from 'fs';
import { resolve } from 'path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
const logExternal: boolean = false;
export default defineConfig({
plugins: [
react(),
@@ -22,11 +25,14 @@ export default defineConfig({
build: {
sourcemap: true,
rollupOptions: {
external: ['react', 'react/jsx-runtime', 'react-native-webview'],
// external: () => {
// fs.writeFileSync('dep.log', `${dep}\n`, { flag: 'a' });
// return false;
// }
// Externalize all non-relative, non-absolute imports (i.e. dependencies)
// Keep only our own sources and the raw internal HTML in the bundle.
external: (id) => {
if (logExternal) fs.writeFileSync('dep.log', `${id}\n`, { flag: 'a' });
const isRelative = id.startsWith('.') || id.startsWith('/');
const isInternalHtml = id.includes('dist-internal/index.html?raw');
return !isRelative && !isInternalHtml;
},
},
lib: {
entry: resolve(__dirname, 'src/index.tsx'),