mini-css-extract-plugin

How do I configure mini-css-extract-plugin in Gatsby?

百般思念 提交于 2021-02-19 08:02:30
问题 The problem When I run npm run build in my Gatsby project, I'm getting multiple warnings of the same kind: warn chunk styles [mini-css-extract-plugin] Conflicting order. Following module has been added: * css ./node_modules/css-loader??ref--12-oneOf-0-1!./node_modules/postcss-loader/src??postcss-4!./node_modules/sass-loader/dist/cjs.j s??ref--12-oneOf-0-3!./src/components/MineralsHeading/MineralsHeading.module.scss despite it was not able to fulfill desired ordering with these modules: * css

Webpack 4 with Less and MiniCssExtractPlugin using entries

倖福魔咒の 提交于 2021-02-19 01:35:37
问题 I have following structure for styles in my application: application - css/ - bootstrap/ - boostrap.less -> has (@import "another.less") - another.less - common/ - common.less - entries/ - bootstrap.js -> has (import style from "../bootstrap/bootstrap.less") - common.js -> has (import common from "../common/common.less") And now I need to create separate CSS-es from styles imported to entries bootstrap.js and common.js. webpack.config.js const MiniCssExtractPlugin = require("mini-css-extract

Why is [name] always main in MiniCssExtractPlugin for webpack?

爱⌒轻易说出口 提交于 2021-02-05 09:12:47
问题 In webpack when configuring the MiniCssExtractPlugin, I don't understand why [name] is always "main"? plugins: [ new MiniCssExtractPlugin({ filename: 'assets/css/[name].css' // where does the name "main" come from? }) ] How could I pass a variable in so that [name] is the name of my app and not "main" without hardcoding it in like filename: 'assets/css/myapp.css' ? Webpack output config: module.exports = { entry: './src/app.js', output: { path: utils.resolve('/dist'), }, The wierd thing is

Why is [name] always main in MiniCssExtractPlugin for webpack?

那年仲夏 提交于 2021-02-05 09:12:46
问题 In webpack when configuring the MiniCssExtractPlugin, I don't understand why [name] is always "main"? plugins: [ new MiniCssExtractPlugin({ filename: 'assets/css/[name].css' // where does the name "main" come from? }) ] How could I pass a variable in so that [name] is the name of my app and not "main" without hardcoding it in like filename: 'assets/css/myapp.css' ? Webpack output config: module.exports = { entry: './src/app.js', output: { path: utils.resolve('/dist'), }, The wierd thing is

Vue Cli 3 disabling code splitting - Can't get rid of the hash file

一世执手 提交于 2021-01-27 19:05:30
问题 I have a vue.config.js setup that works nicely and cancels the default code splitting. But It's still outputs a CSS file with a hash identical to the CSS file with the nice name. I can write a script to delete it, but I wonder if there is a way to set the file to not output the CSS file with the hash. vue.config.js: const webpack = require("webpack"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { outputDir: "../assets/", configureWebpack: { plugins: [ new

Webpack generates js files with css / scss files

心已入冬 提交于 2020-07-09 05:14:32
问题 Description In webpack I am using mini-css-extract-plugin : plugins: [ new MiniCssExtractPlugin({ filename: '[name].[hash].css', chunkFilename: '[name].[hash].css', }) ] To load scss files in chunk files : { test: /\.scss$/, use: [ { loader: MiniCssExtractPlugin.loader, options: { hmr: isdev, reloadAll: true } }, "css-loader", "sass-loader", ] } When I load a scss with an dynamic import : import(/* webpackChunkName: "test" */ 'test.scss') It will generate a test.[hash].css containing the

Webpack generates js files with css / scss files

十年热恋 提交于 2020-07-09 05:14:23
问题 Description In webpack I am using mini-css-extract-plugin : plugins: [ new MiniCssExtractPlugin({ filename: '[name].[hash].css', chunkFilename: '[name].[hash].css', }) ] To load scss files in chunk files : { test: /\.scss$/, use: [ { loader: MiniCssExtractPlugin.loader, options: { hmr: isdev, reloadAll: true } }, "css-loader", "sass-loader", ] } When I load a scss with an dynamic import : import(/* webpackChunkName: "test" */ 'test.scss') It will generate a test.[hash].css containing the

Core-JS 3 Babel results in mini-css-extract-plugin error

笑着哭i 提交于 2020-05-17 07:09:06
问题 Following on from this question I have set up my Webpack 4 config to handle babel-loader like this { module : { rules : [{ test : /\.js$/, // Some module should not be transpiled by Babel // See https://github.com/zloirock/core-js/issues/743#issuecomment-572074215 exclude: ['/node_modules/', /\bcore-js\b/, /\bwebpack\/buildin\b/, /@babel\/runtime-corejs3/], loader : "babel-loader", options : { babelrc : false, // Fixes "TypeError: __webpack_require__(...) is not a function" // https://github