Registry /
devops / emit-file-webpack-plugin
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
EmitFilePlugin
✓ import EmitFilePlugin from 'emit-file-webpack-plugin'
✗ const EmitFilePlugin = require('emit-file-webpack-plugin').default
Default export; in CommonJS you can use require() directly without .default.
EmitFilePlugin
✓ const { EmitFilePlugin } = require('emit-file-webpack-plugin')
✗ const EmitFilePlugin = require('emit-file-webpack-plugin').EmitFilePlugin
Named export is not available in CJS; only default export exists.
EmitFilePlugin
✓ import EmitFilePlugin from 'emit-file-webpack-plugin'
✗ import { EmitFilePlugin } from 'emit-file-webpack-plugin'
Named import is incorrect; the package provides a default export only.
Shows basic usage using CommonJS require with a JSON output file.
const EmitFilePlugin = require('emit-file-webpack-plugin');
module.exports = {
// ... other webpack config
plugins: [
new EmitFilePlugin({
filename: 'version.json',
content: JSON.stringify({ version: process.env.npm_package_version || '0.0.0' })
})
]
};
Errors
Common errors & fixes
TypeError: Class extends value undefined is not a constructor or null
Missing or incompatible webpack and webpack-sources peer dependencies.
fixInstall peer dependencies: npm install --save-dev webpack webpack-sources
Error: Couldn't find plugin with the id "EmitFilePlugin"
Incorrect import of the plugin (named import instead of default).
fixUse default import: import EmitFilePlugin from 'emit-file-webpack-plugin' or const EmitFilePlugin = require('emit-file-webpack-plugin'). TypeError: compilation.hooks.processAssets is not a function
Using the plugin with webpack 4 or older, where processAssets hook does not exist.
fixUpgrade to webpack 5 or use an older version of the plugin that supports webpack 4.
Audit
Dependencies
webpackrequiredPeer dependency; the plugin interfaces with webpack's compilation hooks.
webpack-sourcesrequiredPeer dependency; used for creating source map–aware assets.