question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Concatenating multiple css files breaks js file

See original GitHub issue

Bug report

What is the current behavior? I am trying to extract multiple css files from js files and concatenate it into one css file. I use this documentation https://webpack.js.org/plugins/mini-css-extract-plugin/#extracting-all-css-in-a-single-file. The css files extracted and concatenated well, but after it, js files from which it extracted breaks, i.e. it stops executing at all.

If the current behavior is a bug, please provide the steps to reproduce. I created repo and left only css-loader and optimization section. When optimization section commented out, js correctly executed and in console ‘it works’ appears. But when optimization uncommented, js doesn’t executed and console stays empty Steps to reproduce

git clone https://github.com/felixcatto/webpack_bug.git
cd webpack_bug
npm i
npx webpack-dev-server

What is the expected behavior? Expected result: js at index.js should be executed, i.e. you should see ‘it works’ in console Actual result: js doesn’t executed, because you don’t see anything in console

Other relevant information: webpack version: 4.44.1 Node.js version: 12.18.2 Operating System: ubuntu, 16.04


This issue was moved from webpack/webpack#11436 by @evilebottnawi. Original issue was by @felixcatto.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Jan 28, 2021

Yep, fixed in webpack@5 and in the latest mini-css-extract-plugin version, index was created because you use name: 'index',, name should have extension at the end of file index.css

And yes, using type: 'css/mini-extract', is better then test I will update docs

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combine and Minify Multiple CSS / JS Files - Stack Overflow
Check out minify - it allows you combine multiple js, css files into one just by stacking them into a url, e.g. <script...
Read more >
Should I combine CSS/JS Files on my Website? - GTmetrix
Most webpages typically have several CSS and JS files. Combining all the stylesheets or scripts into a singular respective file may result in...
Read more >
Combine Multiple CSS Files into One File and Minify CSS and ...
Combine all CSS files into one files. NAnt gives you an easy way to do this using Nant concat task. After combining multiple...
Read more >
Combine Resources (CSS and JavaScript Files) - NitroPack
Combining your CSS/JavaScript files into just one CSS/JavaScript file reduces the amount of network requests a browser has to make.
Read more >
Why You SHOULDN'T Combine CSS & JS (performance ...
Merging means to combine multiple files into one. Minification means to remove all the empty spaces in the file so that the code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found