new URL() emits an extra blank css file
See original GitHub issue- Operating System: Ubuntu Linux 16.04 LTS
- Node Version: 14.15.0
- NPM Version: 6.14.8
- webpack Version: 5.44.0
- mini-css-extract-plugin Version: 2.1.0
Expected Behavior
css should be extracted cleanly into a css bundle without emitting artifacts
Actual Behavior
css is extracted into bundle but a bogus css file is also emitted
Code
// webpack.config.js
import CssPlugin from "mini-css-extract-plugin";
export default {
entry: { app: "./src/test-new-url.js" },
mode: "development",
module: {
rules: [
{
test: /\.css$/,
use: [CssPlugin.loader, "css-loader"]
}
]
},
output: { filename: "[name].js" },
plugins: [new CssPlugin({ filename: "[name].css" })]
};
// src/test-new-url.js
new URL("./test-new-url.css", import.meta.url);
/* src/test-new-url.css */
body {
font-size: 14px;
}
How Do We Reproduce?
Place the three files in an environment and build. You will get the following files in dist: app.js app.css (contains the correct, extracted css) b88d04fba731603756b1.css (your hash may vary) which contains the following:
// extracted by mini-css-extract-plugin
export {};
This is the bogus file.
The bogus file does not get emitted with a standard import
import "./src/test-new-url.css";
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Why css file is loading a blank page? - html - Stack Overflow
I'm not sure whether you've not added it here on SO, but your HTML file doesn't contain anything to show. (no <body></body> or...
Read more >url() - CSS: Cascading Style Sheets - MDN Web Docs
The url() CSS function is used to include a file. The parameter is an absolute URL, a relative URL, a blob URL, or...
Read more >Emit new Page objects when new tabs created #386 - GitHub
A nice feature would be if the browser emit an event with a new Page when a new tab is opened by clicking...
Read more >Safari Technology Preview Release Notes - Apple Developer
Added emulation toggles for prefers-reduced-motion and prefers-contrast CSS media features (257197@main); Fixed corrupted styles when adding a new property ...
Read more >webContents | Electron
explicitSet is false when title is synthesized from file url. ... Emitted when there is a new context menu that needs to be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@GregNing Please create reproducible test repo
Original issues can be solved using
type: 'javascript/auto'
, i.e.