Hi I have a webpack config that takes multiple scss file based on a glob entry and a main typescript file. The problem is that it bundles the scss file together in one css file while I want them to be individual based on entry.
Webpack is definitely seeing all the files from the glob.
And the file produced is a bundle of all 3.
I have spent literally hours and hours googling and trying to configure this and its driving me crazy
Heres my current config:
import * as webpack from "webpack";
import * as path from "path";
import * as glob from "glob";
import * as MiniCssExtractPlugin from "mini-css-extract-plugin";
const config: webpack.Configuration = {
mode: "development",
entry: glob.sync(
"./src/themes/**/scss/*.main.scss",
"./src/ts/theme-pack.ts"
),
module: {
rules: [
{
test: /\.ts?$/,
use: "ts-loader",
exclude: /node_modules/
},
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"]
}
]
},
resolve: {
extensions: [".js", ".css", ".ts", ".scss"]
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "./dist")
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[name].css"
})
]
// //Dev server
// devServer: {
// contentBase: __dirname,
// compress: true,
// port: 8080
// }
};
export default config;
Can anyone help? This seems like it should be really simple but…
Thanks in advance