Let's assume the following config:
webpack.config.js
module.exports = {
// ...
output: {
path: path.resolve(__dirname, "dist") // this is the default value
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css" // change this RELATIVE to your output.path!
})
]
// ...
}
Where your output path would resolve to - as an example - /home/terribledev/projects/some-project/dist
.
If you change the filename property of the MiniCssExtractPlugin
options object to ../../[name].css
, it will now be output to /home/terribledev/projects/yourcssfile.css
, e.g.:
module.exports = {
output: {
path: path.resolve(__dirname, "dist")
},
plugins: [
new MiniCssExtractPlugin({
filename: "../../[name].css"
})
]
// ...
}