I would like to use Webpack 4 to transpile on one side my ES6 Javascript separately from my Sass:
Try mini-css-extract-plugin for webpack v4.
I created a separate webpack config file that looks like ...
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: './server/styles/styles.scss',
output: {
path: path.resolve(__dirname, 'public')
},
plugins: [
new MiniCssExtractPlugin({
filename: "styles.css"
})
],
module: {
rules: [
{
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
}
]
}
}
Not sure why, but it's also generating a javascript file with the required css bundle.