App Bundler
The `app-bundler` package is a JavaScript application bundler designed to support multiple module systems including CommonJS, MaskJS, IncludeJS, and AMD. Its core philosophy emphasizes a "no dependency" approach for the development process, aiming to be run only for deployments, and requires minimal configuration, often just a few lines in `package.json`. It focuses on single responsibility – combining modules into JS, CSS, and HTML bundles – and decouples pre- and post-processing through `atma-io` middlewares. This design allows for flexible integration with various preprocessors like TypeScript, Babel, Less, and Sass by utilizing `atma-io` plugins for file loading and transformation. The package is currently at version 0.2.18, and its GitHub repository shows no active development or commits for over six years as of 2026. Consequently, `app-bundler` is considered an abandoned project and is not recommended for new development or actively maintained systems due to potential security vulnerabilities, lack of compatibility with modern JavaScript ecosystems, and absence of community support. Developers should opt for contemporary, actively maintained bundling solutions.
Common errors
-
Error: Cannot find module 'atma-io' from '[path-to-your-project]'
cause `atma-io` is a required peer dependency for `app-bundler`'s file handling and middleware system, but it has not been installed or cannot be resolved by Node.js.fixEnsure `atma-io` is listed in your project's `dependencies` or `devDependencies` and run `npm install` or `yarn install` to properly install it. -
SyntaxError: Unexpected token 'export' (or 'import')
cause `app-bundler` encounters modern ES Module syntax (`import`/`export`) in your source files but does not have a configured `atma-io` middleware to transpile it to a compatible format (like CommonJS).fixInstall and configure an `atma-io` plugin that handles JavaScript transpilation (e.g., integrating Babel) to convert ES Modules to CommonJS. Alternatively, ensure all source files use CommonJS `require()` and `module.exports` syntax. -
Error: EACCES: permission denied, open '[output-file-path]'
cause The user account or process running `app-bundler` lacks the necessary write permissions for the specified output directory or file.fixVerify and adjust the file system permissions for the output directory. On Unix-like systems, ensure the user has write access. If running as a build script, check the environment permissions. As a temporary measure, `sudo npx app-bundler` might work for CLI usage, but is not recommended for automated builds.
Warnings
- breaking This package is effectively abandoned, with no significant updates or commits in over 6 years (as of 2026). It is not recommended for new projects and carries risks for existing ones due to lack of security patches, modern feature support, and community maintenance.
- gotcha `app-bundler` is designed for CommonJS and older web module systems (MaskJS, IncludeJS, AMD). It does not natively understand or process modern ES Modules (ESM) syntax without an external `atma-io` middleware for transpilation, requiring manual setup.
- gotcha The project emphasizes "no configuration" and "decoupled pre- and post-processing." This means advanced build features like automatic code splitting, elaborate asset optimization, or complex plugin ecosystems are not built-in to `app-bundler` itself. These require custom `atma-io` middleware development or integration with other build tools.
Install
-
npm install app-bundler -
yarn add app-bundler -
pnpm add app-bundler
Imports
- bundle
import { bundle } from 'app-bundler';const { bundle } = require('app-bundler'); - CLI Execution (via child process)
const cli = require('app-bundler/bin/app-bundler');const { execSync } = require('child_process'); execSync('npx app-bundler --version', { stdio: 'inherit' }); - Internal `bundle` module (discouraged)
const bundlerModule = require('app-bundler/lib/bundler'); const bundle = bundlerModule.bundle;const { bundle } = require('app-bundler/lib/bundler');
Quickstart
/* package.json example for basic CLI bundling:
"scripts": {
"build": "app-bundler --entry src/main.js --output dist/app.bundle.js"
}
*/
// CLI Usage Example (run in your project's root):
// npx app-bundler --entry src/main.js --output dist/app.bundle.js
// Programmatic Usage Example:
const { bundle } = require('app-bundler');
const path = require('path');
const fs = require('fs');
async function buildApplication() {
const sourceDirectory = path.resolve(__dirname, 'src');
const outputDirectory = path.resolve(__dirname, 'dist');
const entryFilePath = path.join(sourceDirectory, 'main.js');
const outputFilePath = path.join(outputDirectory, 'app.bundle.js');
// Ensure the output directory exists
if (!fs.existsSync(outputDirectory)) {
fs.mkdirSync(outputDirectory, { recursive: true });
}
try {
console.log('Starting application bundling with app-bundler...');
// The `bundle` function's exact API is not explicitly detailed in the README.
// Based on CLI arguments, a simple object might be accepted.
// For production, refer to the source code for precise options.
await bundle({
input: entryFilePath,
output: outputFilePath,
type: 'commonjs' // Specify the module type, e.g., 'commonjs', 'amd', 'maskjs'
// Other options might include 'includejsPaths' or preprocessor configurations
});
console.log(`Bundling completed successfully to: ${outputFilePath}`);
} catch (error) {
console.error('Application bundling failed:', error);
process.exit(1);
}
}
// Uncomment to run the programmatic build (e.g., as part of a custom build script)
// buildApplication();