-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Empty object when importing css #402
Comments
Hi @luxferoo, Could you try this? Encore.configureCssLoader(config => {
config.modules = true;
}); |
@Lyrkan Hello my friend, Encore.configureCssLoader is not a recognized property or method |
Oh, my bad I just noticed that it hasn't been released yet (added in #335), for some reason I thought it was way older than that. So... currently there is no "easy" way to do it. const Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
// (...)
;
// Retrieve the config object
const config = Encore.getWebpackConfig();
// Set "modules" option of the css-loader
for (const rule of config.module.rules) {
if (rule.use) {
for (const ruleUse of rule.use) {
if (ruleUse.loader === 'css-loader') {
ruleUse.options.modules = true;
}
}
}
}
// Export the config (don't call getWebpackConfig() again)
module.exports = config; |
@Lyrkan thanks buddy ! |
Hi, I want to import a css file "css-modules way" but when I do this I got an empty object.
import test from './test.scss' // test == {}
The text was updated successfully, but these errors were encountered: