Commit graph

2 commits

Author SHA1 Message Date
968bc33a7a **chore: remove unused external dependencies from Rollup config**
### Changes:
- Removed the following unused external dependencies from `rollup.config.js`:
  - `crypto`
  - `os`
  - `stream`
  - `http`
  - `http2`
  - `https`
  - `zlib`

### Purpose:
Simplified the Rollup configuration by eliminating unused external dependencies, reducing complexity, and improving build clarity.
2025-06-20 12:03:48 -07:00
bbcecea9d7 **chore: introduce unified Rollup configuration for browser and Node.js builds**
### Changes:
- Added `rollup.config.js` with custom build logic for unified and browser builds:
  - Included TypeScript support with separate configurations (`tsconfig.unified.json` and `tsconfig.browser.json`).
  - Consolidated environment detection logic with `globalThis.__ENV__` for browser, Node.js, and serverless environments.
  - Provided global Buffer polyfill for browser environments.
  - Enabled `inlineDynamicImports` for module compatibility.
- Introduced custom Rollup plugins:
  - Shims for Node.js built-in modules to ensure compatibility in browsers.
  - Fixes for `this` references in TensorFlow.js layers causing errors in browser environments.
- Enabled environment-specific replacements for `process.env.NODE_ENV` during builds.
- Configured outputs for both non-minified and minified builds (`.js` and `.min.js` files).
- Excluded specific dependencies from the bundle to optimize build size.

### Purpose:
Added a versatile Rollup configuration to streamline the build process for both browser and Node.js environments. This setup enhances cross-environment compatibility, reduces redundancy, and ensures better maintainability with unified build logic.
2025-06-19 16:05:59 -07:00