{"id":19426,"library":"create-file-webpack","title":"Create File Webpack Plugin","description":"A simple Webpack plugin that creates a file with specified content at the end of the build process. Version 1.0.2 is the current stable release, with no active maintenance or updates since 2019. It differentiates from similar plugins (e.g., `write-file-webpack-plugin`) by its minimalism: only three options (`path`, `fileName`, `content`). Works with Webpack 4 and earlier; compatibility with Webpack 5 is untested and likely requires adjustments due to hook changes.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/Appius/create-file-webpack","tags":["javascript","webpack","webpack-plugin"],"install":[{"cmd":"npm install create-file-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add create-file-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add create-file-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency - works as a Webpack plugin","package":"webpack","optional":false}],"imports":[{"note":"Package is CJS-only; ESM import will fail unless using bundler that can handle CJS interop.","wrong":"import CreateFileWebpack from 'create-file-webpack'","symbol":"CreateFileWebpack","correct":"const CreateFileWebpack = require('create-file-webpack')"},{"note":"No default export; the entire module is the constructor.","wrong":"const { default: CreateFileWebpack } = require('create-file-webpack')","symbol":"default","correct":"const CreateFileWebpack = require('create-file-webpack')"},{"note":"Use `import = require` for CJS in TypeScript or use `const CreateFileWebpack = require('create-file-webpack')` in JavaScript.","wrong":"import CreateFileWebpack from 'create-file-webpack'","symbol":"CreateFileWebpack (TypeScript)","correct":"import CreateFileWebpack = require('create-file-webpack')"}],"quickstart":{"code":"const CreateFileWebpack = require('create-file-webpack');\n\n// webpack.config.js\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: __dirname + '/dist',\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new CreateFileWebpack({\n      path: './dist',\n      fileName: 'version.txt',\n      content: '1.0.0'\n    })\n  ]\n};","lang":"javascript","description":"Creates a version.txt file in dist/ with content '1.0.0' after build."},"warnings":[{"fix":"Use an alternative plugin or check for updates on GitHub. Consider using 'write-file-webpack-plugin' or custom code.","message":"Webpack 5 may not work due to hook changes.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Ensure the output directory exists or use 'mkdirp' before running Webpack.","message":"Plugin does not create directories recursively; path must exist.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Convert non-string content to string before passing.","message":"Content is always a string; no support for Buffer or streams.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider migrating to a maintained alternative.","message":"Plugin has not been updated since 2019; newer Webpack versions may break.","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure path is a string, e.g., new CreateFileWebpack({ path: './dist', ... })","cause":"path option missing or not a string","error":"Error: 'options.path' must be a string"},{"fix":"Use Webpack 4 or patch the plugin.","cause":"Incompatible with Webpack 5 (hook changed).","error":"TypeError: Cannot read property 'afterCompile' of undefined"},{"fix":"Run 'npm install create-file-webpack --save-dev' and verify node_modules.","cause":"Package not installed or require path incorrect.","error":"Error: Cannot find module 'create-file-webpack'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}