All Projects โ†’ jsilvax โ†’ webpack-omit-js-for-css-plugin

jsilvax / webpack-omit-js-for-css-plugin

Licence: MIT license
This plugin will omit bundled JS files for dependencies that are exclusively CSS, which become obsolete once mini-css-extract-plugin extracts inlined CSS into its own .css file

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to webpack-omit-js-for-css-plugin

Workerize Loader
๐Ÿ—๏ธ Automatically move a module into a Web Worker (Webpack loader)
Stars: โœญ 2,135 (+15150%)
Mutual labels:  webpack-plugin
Antd Dayjs Webpack Plugin
โฐ Day.js webpack plugin for antd
Stars: โœญ 215 (+1435.71%)
Mutual labels:  webpack-plugin
Webpack Shell Plugin
Run shell commands either before or after webpack builds
Stars: โœญ 250 (+1685.71%)
Mutual labels:  webpack-plugin
Emojify Webpack Plugin
๐Ÿฆ„ Turn your code into emoji
Stars: โœญ 178 (+1171.43%)
Mutual labels:  webpack-plugin
Bundle Buddy Webpack Plugin
๐Ÿ๐Ÿ๐Ÿ๐Ÿ bundle-buddy-webpack-plugin ๐Ÿ๐Ÿ๐Ÿ๐Ÿ
Stars: โœญ 199 (+1321.43%)
Mutual labels:  webpack-plugin
Hard Source Webpack Plugin
www.npmjs.com/package/hard-source-webpack-plugin
Stars: โœญ 2,608 (+18528.57%)
Mutual labels:  webpack-plugin
React Core Boilerplate
Powerful ASP.NET Core 3 templates with React, true server-side rendering and Docker support
Stars: โœญ 169 (+1107.14%)
Mutual labels:  webpack-plugin
webpack-extract-translation-keys
This plugin extracts translation keys for applications requiring runtime translations
Stars: โœญ 35 (+150%)
Mutual labels:  webpack-plugin
Unused Files Webpack Plugin
Glob all files that are not compiled by webpack under webpack's context
Stars: โœญ 210 (+1400%)
Mutual labels:  webpack-plugin
Webpack Messages
Beautifully format Webpack messages throughout your bundle lifecycle(s)!
Stars: โœญ 238 (+1600%)
Mutual labels:  webpack-plugin
Wxapp Webpack Plugin
๐Ÿ“ฆ ๅพฎไฟกๅฐ็จ‹ๅบ webpack ๆ’ไปถ
Stars: โœญ 185 (+1221.43%)
Mutual labels:  webpack-plugin
Vue Auto Routing
Generate Vue Router routing automatically
Stars: โœญ 196 (+1300%)
Mutual labels:  webpack-plugin
Critters
๐Ÿฆ” A Webpack plugin to inline your critical CSS and lazy-load the rest.
Stars: โœญ 2,894 (+20571.43%)
Mutual labels:  webpack-plugin
Antd Scss Theme Plugin
A Webpack plugin for customizing Ant Design with an SCSS theme file and using Ant Design's compiled variables in SCSS files throughout your project.
Stars: โœญ 176 (+1157.14%)
Mutual labels:  webpack-plugin
nunjucks-webpack-plugin
A webpack plugin for nunjucks.
Stars: โœญ 27 (+92.86%)
Mutual labels:  webpack-plugin
Html Res Webpack Plugin
plugin for generating html in webpack
Stars: โœญ 170 (+1114.29%)
Mutual labels:  webpack-plugin
Page Skeleton Webpack Plugin
Webpack plugin to generate the skeleton page automatically
Stars: โœญ 2,632 (+18700%)
Mutual labels:  webpack-plugin
sitemap-webpack-plugin
Webpack plugin to generate a sitemap.
Stars: โœญ 72 (+414.29%)
Mutual labels:  webpack-plugin
webpack-bugsnag-plugins
Webpack plugins for common Bugsnag actions.
Stars: โœญ 29 (+107.14%)
Mutual labels:  webpack-plugin
Copy Webpack Plugin
Copy files and directories with webpack
Stars: โœญ 2,679 (+19035.71%)
Mutual labels:  webpack-plugin

npm version Build Status Coverage Status

Webpack Omit JS for CSS Plugin

This plugin will omit bundled JS files for dependencies that are exclusively CSS, which become obsolete once mini-css-extract-plugin extracts inlined CSS into its own .css file

Rationale

This plugin should ONLY be used for LEGACY applications, whose goal is to transition into using a modern build process. This is not an optimized solution. This should ONLY be used as a means to get a legacy application into using bundled entries. The configuration here will NOT provide an optimzed solution for an evergreen project. DO NOT USE THIS if you're working on a NEW PROJECT in 2020+.

In certain cases, you may want to organize some of your CSS dependencies into single files or entry arrays within Webpack. Even though mini-css-extract-plugin extracts CSS into its own .css file, Webpack will still generate a js file that will never be needed. This plugin will omit these types of files before Webpack begins its emitting step, so that you don't have to manually remove them. This plugin is especially useful for Webpack bundles that use a hash in the filename, as these change on every compilation.

Example as a file

// styles.js
require('a.css');
require('b.css');

// webpack.config.js
module.exports = {
	entry: {
		'common.styles' : 'styles.js'
	}
}

โš ๏ธ CSS dependencies in a JS file are 1 level deep. It will not recursively check for dependencies, that are exclusively CSS, when requiring additional JS files.

Example as an array

module.exports = {
	entry: {
		'common.styles' : [
			'a.css',
			'b.css'
		]
	}
}

In both examples Webpack would output: common.styles.js (Not Needed) common.styles.css

Installation

// For Webpack v4.x
npm install --save-dev webpack-omit-js-for-css-plugin

// For Webpack v3.x
npm install --save-dev [email protected]

Usage

const OmitJSforCSSPlugin = require("webpack-omit-js-for-css-plugin");

module.exports = {
	plugins: [
		new OmitJSforCSSPlugin()
	]
}

Note: MiniCssExtractPlugin is a Peer Dependency. You will need to configure that as you normally would in your webpack.config.js

Options

new OmitJSforCSSPlugin(options: object)
Name Type Default Description
preview {Boolean} false Will display a preview of the files that are to be omitted in the console (Will not actually omit)
verbose {Boolean} false Whether it should display which files will be omitted to the console

๐Ÿ”ฅ Additional Notes ๐Ÿ”ฅ

It is highly recommended you only include this plugin when you're building for production.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].