{"id":13671296,"url":"https://github.com/fqborges/webpack-fix-style-only-entries","last_synced_at":"2025-05-16T10:08:15.063Z","repository":{"id":32902499,"uuid":"145431793","full_name":"fqborges/webpack-fix-style-only-entries","owner":"fqborges","description":"Webpack plugin to solve the problem of having a style only entry (css/sass/less) generating an extra js file.","archived":false,"fork":false,"pushed_at":"2023-01-07T08:59:46.000Z","size":1071,"stargazers_count":267,"open_issues_count":23,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-17T07:02:19.845Z","etag":null,"topics":["css","fix","plugin","style","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fqborges.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-20T14:54:45.000Z","updated_at":"2024-04-15T13:37:47.000Z","dependencies_parsed_at":"2023-01-14T22:35:36.655Z","dependency_job_id":null,"html_url":"https://github.com/fqborges/webpack-fix-style-only-entries","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fqborges%2Fwebpack-fix-style-only-entries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fqborges%2Fwebpack-fix-style-only-entries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fqborges%2Fwebpack-fix-style-only-entries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fqborges%2Fwebpack-fix-style-only-entries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fqborges","download_url":"https://codeload.github.com/fqborges/webpack-fix-style-only-entries/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509478,"owners_count":22082892,"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":["css","fix","plugin","style","webpack"],"created_at":"2024-08-02T09:01:05.390Z","updated_at":"2025-05-16T10:08:10.054Z","avatar_url":"https://github.com/fqborges.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/webpack-fix-style-only-entries.svg)](https://www.npmjs.com/package/webpack-fix-style-only-entries)\n\n# [webpack-fix-style-only-entries](https://www.npmjs.com/package/webpack-fix-style-only-entries)\n\nThis is a small plugin developed to solve the problem of having a style only entry (css/sass/less/stylus) generating an extra js file.\n\n\u003e :warning: **The current package version is not compatible with webpack 5.** There is a fork here that is compatible: https://github.com/webdiscus/webpack-remove-empty-scripts\n\nYou can find more info by reading the following issues:\n\n - https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/518\n - https://github.com/webpack-contrib/mini-css-extract-plugin/issues/151\n\nView on: [Github](https://github.com/fqborges/webpack-fix-style-only-entries) - [npm](https://www.npmjs.com/package/webpack-fix-style-only-entries)\n\n## How it works\nIt just find js files from chunks of css only entries and remove the js file from the compilation.\n\n## How to use\ninstall using your package manager of choice:\n - npm: `npm install -D webpack-fix-style-only-entries`\n - yarn: `yarn add -D webpack-fix-style-only-entries`\n\nRequire and add to webpack.config plugins.\n\nWarning: this plugin does not load styles or split your bundles, it just fix chunks of css only entries by removing the (almost) empty js file.\n\n```javascript\n// ... other plugins\nconst MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nconst FixStyleOnlyEntriesPlugin = require(\"webpack-fix-style-only-entries\");\n\nmodule.exports = {\n    entry: {\n        \"main\" : \"./app/main.js\"\n        \"styles\": [\"./common/styles.css\", \"./app/styles.css\"]\n    },\n    module: {\n            {\n                test: /\\.css$/,\n                use: [\n                    MiniCssExtractPlugin.loader,\n                    'css-loader',\n                ]\n            },\n        ]\n    },\n    plugins: [\n        new FixStyleOnlyEntriesPlugin(),\n        new MiniCssExtractPlugin({\n            filename: \"[name].[chunkhash:8].css\",\n        }),\n    ],\n};\n```\n\n## Options\n \n| Name       | Type             | Default                                | Description |\n|------------|---------------   |----------------------------------------|-------------|\n| extensions | Array[string]    | [\"less\", \"scss\", \"css\", \"styl\",\"sass\"] | file extensions for styles      |\n| silent     | boolean          | false                                  | supress logs to console         |\n| ignore     | string or RegExp | undefined                              | match resource to be ignored    |\n\n### Example config:\n    // to identify only 'foo' and 'bar' extensions as styles\n    new FixStyleOnlyEntriesPlugin({ extensions:['foo', 'bar'] }),\n\n## Recipes\n\n### I use a javascript entry to styles:\nGive an especial extension to your file (`.css.js` for example) and configure `new FixStyleOnlyEntriesPlugin({ extensions:['css.js'] })`. See: https://github.com/fqborges/webpack-fix-style-only-entries/issues/8.\n\n### I use webpack-hot-middleware:\nConfigure this plugin as `new FixStyleOnlyEntriesPlugin({ ignore: 'webpack-hot-middleware' })`. See: https://github.com/fqborges/webpack-fix-style-only-entries/issues/12 and https://github.com/fqborges/webpack-fix-style-only-entries/blob/master/test/cases/css-entry-with-ignored-hmr/webpack.config.js.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffqborges%2Fwebpack-fix-style-only-entries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffqborges%2Fwebpack-fix-style-only-entries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffqborges%2Fwebpack-fix-style-only-entries/lists"}