Skip to content Skip to sidebar Skip to footer

How To Prevent Webpack To Create Js File For Css?

const path = require('path'); var webpack = require('webpack'), ExtractTextPlugin = require('extract-text-webpack-plugin'); var nodeExternals = require('webpack-node-externals

Solution 1:

You can use https://www.npmjs.com/package/webpack-fix-style-only-entries

This is a small plugin developed to solve the problem of having a style only entry (css/sass/less) generating an extra js file.


Solution 2:

By default webpack will generate that .min.js file. As in your configuration output all the entry files must generate its js files.

Note: extract-text-webpack-plugin will extract all css/sass located in your js entry files.

It moves all the required *.css modules in entry chunks into a separate CSS file. So your styles are no longer inlined into the JS bundle, but in a separate CSS file (styles.css).

All you need to do is to remove that file if you don't want it. I am using https://github.com/gregnb/filemanager-webpack-plugin/. Where you can define what files you will remove before or after webpack bundling.


Post a Comment for "How To Prevent Webpack To Create Js File For Css?"