Hi, I specified the path in the plugin MiniCssExtractPlugin options but it keeps getting generated in my default output path that i also specified in my webpack. Can anyone help me in this issue? :) thanks
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const build = path.resolve(__dirname, './public')
const js = path.resolve(__dirname, './src')
const config = {
entry: {
client: js + '/client',
plugins: js + '/plugins'
},
output: {
path: build + '/js',
filename: '[name].js'
},
module: {
rules: [
{
test: /\.jsx?/,
loader: 'babel-loader',
include: js,
exclude: /node_modules/
},
{
test: /\.scss$/,
use: ['style-loader', MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader']
}
]
},
plugins: [
new MiniCssExtractPlugin({
path: build + '/css',
publicPath: build,
filename: 'main.css'
})
]
}
module.exports = config
@jairusd Plugin doesn't have path argument (publicPath also). Please read readme before post issue. Thanks!
@evilebottnawi
from the docs i read the comment saying: // Options similar to the same options in webpackOptions.output
did i misunderstand that? if so, how can i specify the location of the output?
@jairusd
new MiniCssExtractPlugin({
filename: "custom/my/folder/for/css/[name].css",
})
@evilebottnawi
publicpath will take if we specify on options miniCSSextractPlugin buit its not working
mentioned in https://webpack.js.org/plugins/mini-css-extract-plugin/
publicpath will take if we specify on options miniCSSextractPlugin buit its not working
mentioned
but it does't work
Here's a workaround by @evilebottnawi :
new MiniCssExtractPlugin({ filename: "custom/my/folder/for/css/[name].css", })
Most helpful comment
@jairusd