-
-
Notifications
You must be signed in to change notification settings - Fork 199
Question: deny extract css from entry js #527
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
Comments
Hi @slince, Could you explain a bit more what you are trying to achieve ? |
@Lyrkan Yes, i just want webpack add style tag. Because css is very simple, it is not necessary to send an http request to download it. |
I see, so you'd need to replace the The bad news is: there is nothing built in the current version of Encore to do that... it may become a bit easier when #509 is released. However you should be able to do it manually: // webpack.config.js
const Encore = require('@symfony/webpack-encore');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
Encore
// (...)
;
// Retrieve the generated config
const config = Encore.getWebpackConfig();
// Replace the mini-css-extract-plugin loader by style-loader
for (const rule of config.module.rules) {
if (rule.use && rule.use[0] === MiniCssExtractPlugin.loader) {
rule.use[0] = 'style-loader';
}
}
// Make sure you export `config` and not
// `Encore.getWebpackConfig()` here
module.exports = config; |
(I can't wait for #509 to be released 👀) |
TKS |
…kan) This PR was merged into the master branch. Discussion ---------- Add Encore.disableCssExtraction() to the public API This PR adds an `Encore.disableCssExtraction()` method that allows to disable the `mini-css-extract-plugin` and use the `style-loader` instead. It can be used to solve various problems that, until now, required a really ugly workaround that relied on our internal implementation (for instance the following commit probably broke some builds that used previous versions of it: 6867443#diff-8beacd21a12ca072bafa4e8e3f1aae6b). Related issues: #3, #256, #348, #527 Commits ------- 347feed Add Encore.disableCssExtraction() to the public API
Hello , i dont want to encore extract css into a separate file,Is this possible?
The text was updated successfully, but these errors were encountered: