tiny-webpack
raw JSON → 0.0.1-alpha.1 verified Fri May 01 auth: no javascript
A JavaScript bundler mimicking Webpack's core features including loader/plugin systems, code splitting, tree shaking, dynamic imports, and multi-page application support. Currently at version 0.0.1-alpha.1 (pre-release) with no stable release. Designed as a lightweight alternative for learning or simple projects, but lacks production readiness. Differentiators include a simplified API and Webpack-compatible configuration, but it is not suitable for production use.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported. ↓
cause tiny-webpack is ESM-only; using CommonJS require() fails.
fix
Use import { jspack } from 'tiny-webpack' or set type: 'module' in package.json.
error TypeError: jspack is not a function ↓
cause Attempted to import default export which does not exist.
fix
Use import { jspack } from 'tiny-webpack' instead of import jspack from 'tiny-webpack'.
error Module not found: Can't resolve 'style-loader' ↓
cause Required loaders are not included with tiny-webpack; must be installed separately.
fix
npm install style-loader less-loader --save-dev
Warnings
breaking Alpha version – no stable API; exports may change without notice. ↓
fix Do not use in production; pin exact version and expect breaking changes.
gotcha Uses ESM only; CommonJS require() will fail. ↓
fix Use ESM imports or upgrade Node.js to support ESM.
gotcha No default export; must import { jspack }. ↓
fix Use named import syntax.
gotcha No pre-built plugins; must implement custom loaders/plugins from scratch. ↓
fix Write your own plugins or use Webpack for plugin ecosystem.
deprecated resolveLoader.modules is not officially supported; may be removed. ↓
fix Use standard node_modules resolution.
Install
npm install tiny-webpack yarn add tiny-webpack pnpm add tiny-webpack Imports
- jspack wrong
const jspack = require('tiny-webpack')correctimport { jspack } from 'tiny-webpack' - default export wrong
module.exports = require('tiny-webpack')correctimport jspack from 'tiny-webpack' - types wrong
import { JspackOptions } from 'tiny-webpack'correctimport type { JspackOptions } from 'tiny-webpack'
Quickstart
// jspack.config.js
export default {
entry: './src/index.js',
output: {
path: process.cwd() + '/dist',
filename: 'bundle.js'
},
mode: 'development'
};
// build.js
import { jspack } from 'tiny-webpack';
import config from './jspack.config.js';
const compiler = jspack(config);
compiler.run((err, stats) => {
if (err) {
console.error(err);
return;
}
console.log(stats.toJson());
});