{"id":20549,"library":"shebang-loader","title":"shebang-loader","description":"Webpack loader that strips the shebang (#!) line from script files, allowing them to be bundled as modules. Current version 0.0.1 is a minimal, unmaintained package with no releases since 2014. It only works with webpack 1.x and provides no configuration options. Not suitable for modern projects; alternatives include inline loader syntax or manual file transforms.","status":"deprecated","version":"0.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/javascriptismagic/shebang-loader","tags":["javascript","webpack","loader","shebang","#"],"install":[{"cmd":"npm install shebang-loader","lang":"bash","label":"npm"},{"cmd":"yarn add shebang-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add shebang-loader","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The exclamation mark syntax is used before the resource; some users mistakenly omit '!.' or use 'loader!' syntax wrong.","wrong":"import script from 'shebang!./file.js';","symbol":"default (loader)","correct":"import script from 'shebang-loader!./file.js';"},{"note":"Webpack 1 uses 'loaders' array, modern webpack uses 'rules'. The package is from webpack 1 era.","wrong":"module.exports = { module: { loaders: [ { test: /\\.js$/, loader: 'shebang-loader' } ] } }","symbol":"shebang-loader (config entry)","correct":"module.exports = { module: { rules: [ { test: /\\.js$/, use: 'shebang-loader' } ] } }"},{"note":"Users often forget the '-loader' suffix.","wrong":"var script = require('shebang!./file.js');","symbol":"require (CommonJS)","correct":"var script = require('shebang-loader!./file.js');"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        use: 'shebang-loader'\n      }\n    ]\n  }\n};\n\n// Now require a CLI script with a shebang line\n// bin/hello.js: #!/usr/bin/env node\\nconsole.log('Hello');\nconst hello = require('shebang-loader!./bin/hello.js');\nconsole.log(hello); // 'Hello'","lang":"javascript","description":"Webpack config to strip shebang from .js files and an example requiring a CLI script."},"warnings":[{"fix":"Use webpack 1 or manually strip shebang with a preprocessor. Consider using a custom loader or the 'imports-loader' with shebang removal.","message":"The shebang-loader only works with webpack 1.x. In webpack 2+, it is not officially supported and may cause errors.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Replace with a custom webpack loader that uses regex to remove shebang lines, or use an alternative package like 'strip-loader'.","message":"Package has no updates since 2014 and is effectively abandoned. It does not support modern webpack versions (2, 3, 4, 5).","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"If on Windows, ensure line endings are Unix-style (LF) or modify the loader to handle CRLF.","message":"The loader only strips lines that start with '#!', but does not handle files that have no shebang, causing no issues. However, it may not remove carriage return characters on Windows line endings.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install shebang-loader --save-dev' and use correct loader name: 'shebang-loader' (not 'shebang').","cause":"shebang-loader is not installed or the loader name is misspelled.","error":"Module not found: Error: Can't resolve 'shebang-loader'"},{"fix":"Ensure files have a shebang line, or remove the loader rule for files without shebangs.","cause":"The loader expects a shebang line; if missing, it may error (depends on implementation).","error":"Error: Shebang loader is used but the file does not have a shebang"},{"fix":"Use webpack 1 or avoid shebang-loader; it is not maintained for newer webpack versions.","cause":"Using shebang-loader with modern webpack may trigger compatibility warnings due to polyfill removal.","error":"BREAKING CHANGE: webpack < 5 used to include polyfills for node.js built-in modules..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}