oxjs/vite.config.build.js
Sanjay Bhangar d51d3f60f1 Complete core ES module migration with build system and tests
- Enhanced build system to generate ESM, UMD, and minified formats
- Fixed test extraction script to properly parse OxJS inline tests
- Added comprehensive test infrastructure with Vitest
- Successfully extracted 22 test files from inline documentation
- Verified builds work in browser and Node.js environments
- Maintained full backward compatibility with Ox.load() pattern
- Updated .gitignore to exclude build artifacts (dev/, min/, dist/, test/extracted/)

Generated with AI assistance
2026-02-09 17:58:48 +05:30

41 lines
No EOL
984 B
JavaScript

import { defineConfig } from 'vite';
import { resolve } from 'path';
import fs from 'fs';
import path from 'path';
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/ox/index.js'),
name: 'Ox',
formats: ['es', 'umd'],
fileName: (format) => {
if (format === 'es') return 'ox.esm.js';
if (format === 'umd') return 'ox.umd.js';
return `ox.${format}.js`;
}
},
rollupOptions: {
output: {
globals: {
// Any external dependencies would go here
},
// Keep all exports at top level
preserveModules: false,
// Ensure compatibility with older environments
generatedCode: {
constBindings: false
}
}
},
sourcemap: true,
minify: false, // We'll minify separately for min/Ox.js
outDir: 'dist',
emptyOutDir: false
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
}
}
});