Macross Bundler
raw JSON →Macross Bundler is a set of managed Webpack configuration scripts designed to simplify the build process for web applications. It abstracts away complex Webpack setups, providing a streamlined command-line interface for common tasks like starting a development server and building for production. The current stable version is 0.1.24, indicating it's still in early development, and API changes can be expected. Its primary differentiator lies in providing a highly opinionated and managed configuration experience, similar to tools like Create React App but with custom extensions, notably including specific configurations for CDN prefixes and backend proxies, which may suggest an origin or strong influence from enterprise environments like Rakuten. It requires Node.js >= 16 and has peer dependencies on Webpack >= 5 and React >= 16.
Common errors
error sh: macross-bundler: command not found ↓
macross-bundler is installed as a devDependency (npm install --save-dev macross-bundler), and that your package.json scripts call macross-bundler directly or via npx (e.g., "start": "macross-bundler start"). Always run npm install after cloning a project. error Error: Cannot find module 'webpack' or 'react' ↓
npm install webpack@^5 react@^16. error ERR_MODULE_NOT_FOUND in macross.config.js ↓
macross.config.js file uses export default. If your package.json does not have "type": "module", consider renaming macross.config.js to macross.config.mjs to force ESM interpretation. Warnings
breaking As a 0.1.x version package, the API of `macross-bundler` is highly unstable and subject to frequent breaking changes without prior major version increments. Relying on specific internal behaviors or undocumented features is risky. ↓
gotcha The `macross.config.js` file is expected to use ESM syntax (`export default`). Attempting to use CommonJS (`module.exports = {}`) will result in module resolution errors. ↓
gotcha Macross Bundler has strict peer dependencies on `webpack` (>= 5) and `react` (>= 16). Mismatched versions will lead to installation warnings or runtime errors during the build process. ↓
gotcha Configuration options like `cdnPrefixUrl` and `backendProxy` suggest an opinionated setup potentially tailored for specific enterprise environments (e.g., Rakuten). These might not be applicable or require careful customization for general-purpose projects. ↓
Install
npm install macross-bundler yarn add macross-bundler pnpm add macross-bundler Imports
- macross-bundler CLI commands wrong
import { start } from 'macross-bundler'; // Not an exposed JS API const { build } = require('macross-bundler'); // Not an exposed JS APIcorrectnpx create-macross-app my-app # or use in package.json scripts: // "start": "macross-bundler start" // "build": "macross-bundler build" - Macross Configuration Object wrong
import MacrossConfig from 'macross-bundler/config'; // Config is exported from your local file, not imported from the package const config = require('./macross.config.js'); // Use 'import' for ESM config files.correct// macross.config.js export default { entries: { 'index': './src/index.js' }, publicDir: './templates', // ... other config options }; - MacrossConfig (Type Definition) wrong
import { MacrossConfig } from 'macross-bundler'; // Use 'import type' for type-only imports.correctimport type { MacrossConfig } from 'macross-bundler';
Quickstart
npx create-macross-app my-app
cd my-app
npm install
// macross.config.js (example configuration)
// This file defines how your project is built.
export default {
entries: {
'index': './src/index.js',
},
publicDir: './templates',
outDir: '../resources/static',
templateOurDir: '../resources/templates',
cdnPrefixUrl: 'https://cdn.example.com', // Customize for your CDN
backendProxy: 'http://localhost:3000', // Proxy API requests in dev
devServerPort: 1234,
};
npm run start
// Open your browser to http://localhost:1234