{"id":20397866,"url":"https://github.com/klaytonfaria/webpack-exclude-assets-plugin","last_synced_at":"2025-04-12T13:10:09.493Z","repository":{"id":57397415,"uuid":"145929173","full_name":"klaytonfaria/webpack-exclude-assets-plugin","owner":"klaytonfaria","description":"Webpack plugin to exclude assets from webpack output based on a path RegExp pattern.","archived":false,"fork":false,"pushed_at":"2018-11-03T14:23:48.000Z","size":65,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-12T13:09:58.316Z","etag":null,"topics":["assets","chuncks","exclude","name","path","plugin","webpack","webpack-plugin","webpack4"],"latest_commit_sha":null,"homepage":null,"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/klaytonfaria.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-24T01:59:02.000Z","updated_at":"2023-03-07T13:26:29.000Z","dependencies_parsed_at":"2022-09-07T01:53:33.412Z","dependency_job_id":null,"html_url":"https://github.com/klaytonfaria/webpack-exclude-assets-plugin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaytonfaria%2Fwebpack-exclude-assets-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaytonfaria%2Fwebpack-exclude-assets-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaytonfaria%2Fwebpack-exclude-assets-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaytonfaria%2Fwebpack-exclude-assets-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klaytonfaria","download_url":"https://codeload.github.com/klaytonfaria/webpack-exclude-assets-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571883,"owners_count":21126522,"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":["assets","chuncks","exclude","name","path","plugin","webpack","webpack-plugin","webpack4"],"created_at":"2024-11-15T04:17:03.342Z","updated_at":"2025-04-12T13:10:09.452Z","avatar_url":"https://github.com/klaytonfaria.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Webpack exclude assets plugin  ![npm](https://img.shields.io/npm/dt/webpack-exclude-assets-plugin.svg)\n===\n[![NPM](https://nodei.co/npm/webpack-exclude-assets-plugin.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/webpack-exclude-assets-plugin/)\n\n\nWebpack plugin to exclude assets from webpack output based on a path RegExp pattern.\n\n## Why?\n\nWhen we have css, scss, sss, stylus or some style file as an entry, for example, using some plugin to extract chunk as a separated file as [`mini-css-extract-plugin`](https://github.com/webpack-contrib/mini-css-extract-plugin) or [`extract-text-webpack-plugin`](https://github.com/webpack-contrib/extract-text-webpack-plugin), Webpack give us as an output a js file with some empty functions. I think that's files doesn't matter for us, so this plugin removes it. :)\n\n## Configuration:\n\n```js\n// webpack.config.js\nconst path = require('path');\nconst MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nconst ExcludeAssetsPlugin = require(\"webpack-exclude-assets-plugin\");\n\nmodule.exports = {\n  entry: { ... },\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'js/[name].js'\n  },\n  plugins: [\n    new MiniCssExtractPlugin({\n      filename: \"[name].css\"\n    }),\n    new ExcludeAssetsPlugin({\n      // path: string | [string]\n      path: [\n        '^js\\/css\\/.*\\.js$',\n        '^.*(?=!(foo)).+some[cool]RegExpHere$'\n      ]\n    })\n  ],\n  module: { ... },\n  resolve: { ... }\n};\n```\n\n## Example:\n\n```js\n// webpack.config.js\nconst path = require('path');\nconst MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nconst ExcludeAssetsPlugin = require(\"webpack-exclude-assets-plugin\");\n\nmodule.exports = {\n  entry: {\n    app: path.resolve(__dirname, 'js/app.js'),\n    \"css/app\": path.resolve(__dirname, 'css/app.css')\n  },\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'js/[name].js'\n  },\n  plugins: [\n    new MiniCssExtractPlugin({\n      filename: \"[name].css\"\n    }),\n    new ExcludeAssetsPlugin({\n      path: ['^js\\/css\\/.*\\.js$']\n    })\n  ],\n  module: {\n    rules: [\n      {\n        test: /\\.css$/,\n        exclude: /node_modules/,\n        use: [\n          MiniCssExtractPlugin.loader,\n          'css-loader',\n        ]\n      }\n    ]\n  },\n  resolve: {\n    extensions: ['.css']\n  }\n};\n```\n### Output tree **before** using `webpack-exclude-assets-plugin`:\n```\n.\n├── css\n│   └── app.css\n└── js\n    ├── app.js\n    └── css\n        └── app.js\n\n3 directories, 3 files\n\n```\n### Output file tree **after** using `webpack-exclude-assets-plugin`:\n```\n.\n├── css\n│   └── app.css\n└── js\n    └── app.js\n\n2 directories, 2 files\n\n```\n\n## License\n\n#### [MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaytonfaria%2Fwebpack-exclude-assets-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklaytonfaria%2Fwebpack-exclude-assets-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaytonfaria%2Fwebpack-exclude-assets-plugin/lists"}