-
-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack html-loader and MiniCssExtractPlugin #789
Comments
Thank you for creating this issue. However, issues need to follow one of our templates so that we can clearly understand your particular circumstances. Please help us help you by recreating the issue using one of our templates. |
Expected Behaviorfile
Actual Behaviorfile
Code |
I have the same problem. Have you solved it now |
I have the same problem too. If I remove MiniCssExtractPlugin from plugins list HtmlWebpackPlugin outputs all css files normally. But with MiniCssExtractPlugin css files became empty just containing only these two lines :
|
并且如果你使用css-loader 打包 会提示 css文件有非法的注释的翻译结果 |
I have the same problem, did you find the solution to avoid "// extracted by mini-css-extract-plugin export {};" ? |
Seeing this issue as well. Are there any work-arounds? |
you probably need to add css import in application ( in |
Ah right. In my case, I don't have a javascript app, I am just using Webpack to process some templates / assets and rewrite the URLs. |
Same issue here, this is really weird. |
Looking for solution too, but it seem to be the expected behaviour, mini-css-extract-plugin/test/enforce-esm.test.js Lines 20 to 23 in 1ffad9b
|
my solution, partial of my {
test: /\.css$/,
exclude: /prime(vue|icons).+\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /prime(vue|icons).+\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: { emit: false, esModule: false },
},
"css-loader",
],
}, |
I'm using setup from getting-started webpack page:
And this one works OK if I include
import './style.css';
at the top ofsrc/index.js
. Inside of the produceddest/index.html
I get the line where the extracted CSS style is generated as<link href="main.css" rel="stylesheet">
.Now what I want is to remove that line
import './style.css';
at the top ofsrc/index.js
and use instead of that one<link rel="stylesheet" type="text/css" href="style.css">
that I will place inside the templatesrc/index.html
.When doing this, generated
dest/index.html
gets correctly the line<link rel="stylesheet" type="text/css" href="b88d04fba731603756b1.css">
and the filedest/b88d04fba731603756b1.css
is generated, but it's content is wrong as I get this instead of real css styles:Is there a way to use
html-loader
plugin together withMiniCssExtractPlugin
, so that I do not need to import css inside js files but instead import it inside html template?The text was updated successfully, but these errors were encountered: