{"id":21025241,"url":"https://github.com/samvv/shebang2-loader","last_synced_at":"2025-06-11T10:13:35.582Z","repository":{"id":42810304,"uuid":"269567185","full_name":"samvv/shebang2-loader","owner":"samvv","description":"An alternative Webpack loader for Unix-style shebangs (usually #!/usr/bin/env node)","archived":false,"fork":false,"pushed_at":"2023-03-14T16:48:05.000Z","size":498,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T15:36:15.300Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/shebang2-loader","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samvv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-05T08:00:42.000Z","updated_at":"2022-07-11T05:35:06.000Z","dependencies_parsed_at":"2024-06-21T20:21:46.723Z","dependency_job_id":"82686a90-a1d0-4000-b1be-459bf9f18b6e","html_url":"https://github.com/samvv/shebang2-loader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvv%2Fshebang2-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvv%2Fshebang2-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvv%2Fshebang2-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvv%2Fshebang2-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samvv","download_url":"https://codeload.github.com/samvv/shebang2-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243456653,"owners_count":20293907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T11:31:46.337Z","updated_at":"2025-03-13T18:25:17.539Z","avatar_url":"https://github.com/samvv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shebang2-loader\n\nThis is an alternative Webpack loader for Unix-style shebangs (usually `#!/usr/bin/env node`). It is meant to replace the\n[shebang-loader](https://npmjs.com/package/shebang-loader), which appears to be unmaintained and does not have proper\nsupport for source maps.\n\n## Usage\n\n1. Make this package available to Webpack:\n\n   ```\n   npm i -D shebang2-loader\n   ```\n   or\n   ```\n   yarn add -D shebang2-loader\n   ```\n\n2. Configure the loader in your `webpack.config.js`.\n\n   ```js\n   module: {\n     rules: [\n       // ...\n       { test: /example\\/index.js$/, loader: \"shebang2-loader\" },\n     ]\n   }\n   ```\n   \n   **Make sure to place `shebang2-loader` as the last rule in the list of rules, so that Webpack will process it first.**\n   \n   Here's a full example using Webpack's [BannerPlugin](https://webpack.js.org/plugins/banner-plugin/) to re-generate the\n   shebang for a CLI application.\n\n   ```js\n   const webpack = require(\"webpack\");\n   const path = require(\"path\");\n\n   module.exports = {\n     target: 'node',\n     mode: 'development',\n     entry: './main.js',\n     output: {\n       filename: 'dist.js',\n       path: path.resolve(__dirname),\n     },\n     plugins: [\n       new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),\n     ],\n     devtool: 'source-map',\n     module: {\n       rules: [\n         { test: /\\.m?js$/, exclude: /node_modules/, loader: 'babel-loader' },\n         { test: /example\\/index.js$/, loader: \"shebang2-loader\" },\n       ]\n     }\n   };\n   ```\n   \n3. Run Webpack as you'd usually do.\n\n   ```\n   webpack --watch --config webpack.config.js\n   ```\n   \n## License\n\nThis software is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamvv%2Fshebang2-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamvv%2Fshebang2-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamvv%2Fshebang2-loader/lists"}