Skip to content

Instantly share code, notes, and snippets.

@ogonkov
Last active September 10, 2020 06:58
Show Gist options
  • Save ogonkov/d4060500cf3d5b8b78e61fac9b8befe9 to your computer and use it in GitHub Desktop.
Save ogonkov/d4060500cf3d5b8b78e61fac9b8befe9 to your computer and use it in GitHub Desktop.
Mini CSS Extract Plugin error webpack-contrib/mini-css-extract-plugin#205
npm i
npm run build -- index.js
import styles from './item.css';
console.log(styles);
.item {
color: red;
}
{
"private": true,
"name": "example",
"scripts": {
"build": "webpack"
},
"devDependencies": {
"css-loader": "^4.3.0",
"mini-css-extract-plugin": "^0.11.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
}
}
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
devtool: false,
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
{
loader: 'css-loader',
options: {
modules: {
exportOnlyLocals: true
}
}
}
]
}
]
},
plugins: [
new MiniCssExtractPlugin(),
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment