Steal-tools is a robust collection of command-line and programmatic utilities designed for building, packaging, and optimizing JavaScript applications, particularly those utilizing the StealJS module loader. It supports a wide array of module formats including ES6 Modules, CommonJS, and AMD, facilitating the creation of applications and plugins that load efficiently. As of version 2.3.0, it leverages modern JavaScript features like dynamic `import()` via `esprima-next` and uses `terser` as its default minifier. This package is an integral part of the larger StealJS ecosystem, working in tandem with the `steal` module loader for client-side dependency management, and is actively maintained with regular patch and minor releases focusing on compatibility and feature enhancements. It differentiates itself through features like intelligent bundling, progressive loading, and comprehensive project exporting capabilities, all aimed at improving application load times and caching strategies.
npm install steal-toolsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically build a StealJS application using `steal-tools.build`. It configures a basic build, specifies entry points, enables minification and asset bundling, and sets an output directory.
Review your minification setup. If issues arise, consult `terser` documentation or consider providing a custom `minify` function in `buildOptions` to use an alternative minifier.
Ensure your Node.js environment is within the supported range (10.x - 14.x) as specified in the `engines` field of the `package.json`. Use a tool like `nvm` to manage Node.js versions.
If encountering transpilation errors with modern JavaScript, ensure `forceES5` is set correctly in your build configuration. If you intend to preserve ES2015+ syntax, explicitly set `forceES5: false`. Update to `>=2.2.3` to resolve `estraverse`-related parsing issues.
Upgrade to `steal-tools@2.2.1` or newer to incorporate the fix for `rollup-plugin-commonjs`.
Review your codebase for non-standard or highly experimental JavaScript syntax. No specific fix is usually needed, but be aware of the parser update if encountering new syntax errors.
Ensure `steal-tools` is imported as a CommonJS module using `const stealTools = require('steal-tools');` or as a default ESM import `import stealTools from 'steal-tools';` and then access the `build` method as `stealTools.build()`.Check the code causing the error for syntax that might be unsupported by `terser` or aggressive minification. Adjust `buildOptions.minify` (e.g., set to `false` temporarily, or provide a custom minifier function) or refer to `terser`'s documentation for compatible syntax.
Ensure `forceES5` is set to `false` in your `stealTools.build` options if you want to preserve ES2015+ syntax. Upgrade `steal-tools` to version `>=2.2.3` to fix issues with `estraverse` not supporting modern AST nodes.
Ensure `bundleSteal: true` is included in your `stealTools.build` options if you want `steal.js` to be part of your main bundle. Alternatively, if `bundleSteal` is `false`, ensure `steal.js` is loaded separately in your HTML before your application's bundles.