{"id":14976465,"url":"https://github.com/sanjsanj/webpack-entry-plus","last_synced_at":"2025-08-19T16:33:01.140Z","repository":{"id":26895393,"uuid":"110350783","full_name":"sanjsanj/webpack-entry-plus","owner":"sanjsanj","description":"Generate dynamic webpack bundle output names from known or unknown entry files","archived":false,"fork":false,"pushed_at":"2024-06-14T06:50:26.000Z","size":2042,"stargazers_count":24,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-15T04:39:12.147Z","etag":null,"topics":["dynamic","entry","output","plugin","webpack","webpack3"],"latest_commit_sha":null,"homepage":"","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/sanjsanj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-11-11T14:14:22.000Z","updated_at":"2024-06-14T06:50:24.000Z","dependencies_parsed_at":"2024-06-18T21:32:03.031Z","dependency_job_id":"1e8aab9f-7cce-4c40-a146-3a193bde2c92","html_url":"https://github.com/sanjsanj/webpack-entry-plus","commit_stats":{"total_commits":59,"total_committers":3,"mean_commits":"19.666666666666668","dds":0.4067796610169492,"last_synced_commit":"34fc01913e837f951412a982c206368b62a36693"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjsanj%2Fwebpack-entry-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjsanj%2Fwebpack-entry-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjsanj%2Fwebpack-entry-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjsanj%2Fwebpack-entry-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanjsanj","download_url":"https://codeload.github.com/sanjsanj/webpack-entry-plus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230364001,"owners_count":18214717,"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":["dynamic","entry","output","plugin","webpack","webpack3"],"created_at":"2024-09-24T13:53:55.798Z","updated_at":"2024-12-19T02:07:34.170Z","avatar_url":"https://github.com/sanjsanj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-entry-plus\n\nGenerate dynamic webpack bundle output names from wildcarded entry files.\n\n[![NPM](https://nodei.co/npm/webpack-entry-plus.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/webpack-entry-plus/)\n\n[![Code Size](https://img.shields.io/bundlephobia/minzip/react.svg)](https://github.com/sanjsanj/webpack-entry-plus/blob/master/src/entry-plus.js)\n[![Build Status](https://travis-ci.org/sanjsanj/webpack-entry-plus.svg?branch=master)](https://travis-ci.org/sanjsanj/webpack-entry-plus) [![codecov](https://codecov.io/gh/sanjsanj/webpack-entry-plus/branch/master/graph/badge.svg)](https://codecov.io/gh/sanjsanj/webpack-entry-plus)\n\n## Why?\n\nThis package solves the problem of not knowing (or wanting to hardcode) all of our output bundles' names. Particularly useful if you're building a CMS-based architecture or multi-page app. [Read more about it here](https://medium.com/@sanjsanj/webpack-creating-dynamically-named-outputs-for-wildcarded-entry-files-9241f596b065).\n\n## Install\n\nInstall with npm:\n\n```\nnpm install --save-dev webpack-entry-plus\n```\n\n## API\n\nMust be passed an argument which is an `[ Array of { Objects } ]` that comply to this schema:\n\n```\n[\n  {\n    entryFiles: Array of String(s),\n    outputName: String, or Function that returns a String,\n  },\n]\n```\n\nIf we want to use wildcard matchers to include unknown files, use the included `glob` package like so:\n\n```\n// import glob\nconst glob = require('glob');\n\n[\n  {\n    entryFiles: glob.sync('./Folder1/*.js'),\n    outputName: String or Function that returns String,\n  },\n]\n```\n\nIf we want to create a dynamic output name, pass a function in to `outputName` that takes one argument and returns the `[name]` we want to use. The argument, `(item)` in this example, is the filepath for the file being processed:\n\n```\n[\n  {\n    entryFiles: Array of String(s),\n    outputName(item) {\n      return item.replace('unwanted text', 'text');\n      // or any other string transform we want\n      // must return a string which will become the [name] in our output\n    },\n  },\n]\n```\n\n- If we pass a String in to `outputName` it will bundle all the `entryFiles` in to one.\n\n- If we pass a Function in to `outputName` it will process each entry file in to it's own bundle, using the returned value of `outputName(entryFile[singular])` as the `[name]` in webpack's output object.\n\n## Example Usage\n\n```\n// webpack.config.js\n// First `import` or `require` this package, and glob for wildcard matching, e.g:\n\nconst entryPlus = require('webpack-entry-plus');\nconst glob = require('glob');\n\n// Then create an Array of Objects containing our entry files:\n\nconst entryFiles = [\n  {\n    entryFiles: ['file1.js'],\n    outputName: 'bundle1',\n  },\n  {\n    entryFiles: ['file2.js', 'file3.js'],\n    outputName: 'bundle2',\n  },\n  {\n    entryFiles: ['react', 'react-dom'],  // node modules work too\n    outputName: 'react',\n  },\n  {\n    entryFiles: glob.sync('./core/*.js'),\n    outputName: 'core',\n  },\n  {\n    entryFiles: glob.sync('./Folder1/**/*-entry.js'),\n    outputName(item) {\n      return item.replace('Folder1/', '../');\n    },\n  },\n];\n\nThen pass the function in to the `entry` point of our config:\n\nmodule.exports = {\n  entry: entryPlus(entryFiles),\n\n  output: {\n    filename: '[name].js',\n  },\n\n  ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanjsanj%2Fwebpack-entry-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanjsanj%2Fwebpack-entry-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanjsanj%2Fwebpack-entry-plus/lists"}