transform-loader
raw JSON → 0.2.4 verified Sat Apr 25 auth: no javascript maintenance
Webpack loader that allows using browserify transforms in webpack builds. Version 0.2.4 is the latest stable release (last updated 2017). It enables reuse of existing browserify transform modules (like brfs, coffeeify) within webpack's loader pipeline. Key differentiator: bridges browserify ecosystem transforms to webpack without manual porting. Supports webpack 1.x and 2.x but is not actively maintained.
Common errors
error Module not found: Error: Can't resolve 'transform-loader/cacheable' ↓
cause Incorrect subpath import or missing npm install
fix
Ensure 'transform-loader' is installed: npm install transform-loader --save-dev
error Error: DeprecationWarning: loaderUtils.getOptions is deprecated ↓
cause Using transform-loader with webpack 4+ which deprecates old loader utilities
fix
Upgrade to webpack 5 and consider using alternatives like 'brfs' loader directly
error TypeError: this.getOptions is not a function ↓
cause transform-loader not compatible with webpack 5's loader API
fix
Use webpack 4 or migrate to a maintained loader like 'brfs-loader'
Warnings
deprecated transform-loader uses deprecated loader API in webpack 2+ ↓
fix For webpack 2+, use 'enforce: post' in rule or migrate to webpack-native loaders.
gotcha Cacheable variant must be imported as subpath '/cacheable' not as query parameter ↓
fix Use 'transform-loader/cacheable?brfs' instead of 'transform-loader?brfs&cacheable'.
breaking Webpack 5 removed LoaderOptionsPlugin, breaking configs using plugin transform index ↓
fix Define transforms directly in rule options: { loader: 'transform-loader', options: { transforms: [...] } } or avoid using plugin-based transforms.
gotcha Applied to all files in default config, causing performance degradation in watch mode ↓
fix Use 'transform-loader/cacheable' variant or narrow test pattern to specific files.
deprecated Project last updated in 2017; no webpack 5 support ↓
fix Consider using alternative loaders like brfs directly or migrate to webpack-native solutions.
Install
npm install transform-loader yarn add transform-loader pnpm add transform-loader Imports
- default import wrong
const transformLoader = require('transform-loader')correctimport transformLoader from 'transform-loader' - cacheable variant wrong
import 'transform-loader?cacheable'correctimport 'transform-loader/cacheable' - Webpack config usage
module.exports = { module: { rules: [{ test: /\.js$/, loader: 'transform-loader?brfs' }] } }
Quickstart
// webpack.config.js
module.exports = {
context: __dirname,
entry: './index.js',
module: {
loaders: [
{
test: /\.js$/,
loader: 'transform-loader?brfs'
}
]
}
};