weapp-minipack is a JavaScript bundler specifically designed for WeChat mini-programs, with a strong emphasis on TypeScript support. Currently at version 0.1.20, it provides both a command-line interface (CLI) for quick project setup and a programmatic API for more custom build workflows. The tool aims to simplify the development process for mini-programs by handling TypeScript compilation, asset copying, and offering a robust plugin system for extending its functionality, such as WXSS minification. Its release cadence is likely irregular given its early stage of development, but it actively integrates with standard tools like `esbuild` for performance. A key differentiator is its focus on the unique structure and requirements of WeChat mini-programs, providing specific configurations like `miniprogramProjectPath` and direct integration for environment variable injection.
npm install weapp-minipackVerified import paths — ran on the pinned version, not inferred.
Demonstrates programmatic usage to initialize and run the bundler with a custom configuration, including a basic plugin for WXSS processing.
Always pin to exact versions (e.g., `"weapp-minipack": "0.1.20"`) and thoroughly review release notes before updating to avoid unexpected breakages.
Ensure your configuration file path is correct when using the CLI (`weapp-minipack -c ./config.js`) or that the config object is correctly structured when using the programmatic API.
For ESM projects, use `import` statements as shown in the `imports` section. For CJS projects, stick to `require`. Ensure your `tsconfig.json` `module` and `moduleResolution` are set appropriately (e.g., `"module": "NodeNext", "moduleResolution": "NodeNext"`).
Ensure `weapp-minipack` is installed locally (`npm install weapp-minipack` or `yarn add weapp-minipack`) if using programmatic API, or globally (`npm install -g weapp-minipack`) for CLI. Verify `import` vs `require` usage matches your project type.
Refactor your imports to use `import { Entry } from 'weapp-minipack';` and `import path from 'path';`. If you need to read JSON or CJS modules, consider dynamic `import()` or `createRequire`.Provide a `configPath` option like `{ configPath: path.resolve(__dirname, 'minipack.config.js') }` or pass the configuration object directly as `{ config: { /* your config here */ } }` to the `Entry` constructor.No dependency data recorded yet.