Webpack Building Both Css And Js Files
my problem is that webpack builds both js and css files when the input is sass file. Here is what webpack outputs. I just want css files to be outputed for scss, not both. I do not
Solution 1:
Every entry point gets a JavaScript bundle with the webpack bootstrap code, even if the content is extracted with the extract-text-webpack-plugin
. Instead of using a separate entry point for the CSS you should include them in the corresponding entry point, which also makes sense conceptually as the styles are going to be used in them. Each entry
also accepts an array.
Your entry should be:
entry: {
admin: [SRC + "/js/admin/index.js", SRC + "/scss/admin/index.scss"],
main: [SRC + "/js/main/index.js", SRC + "/scss/main/index.scss"]
},
If you want to keep the names mainstyles
and adminstyles
you can also change the extract-text-webpack-plugin
to:
newExtractTextPlugin("[name]styles-bundle.css")
Post a Comment for "Webpack Building Both Css And Js Files"