0👍
✅
Solution for me was to extract the css using mini-css-extract-plugin. Updated webpack config is:
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
entry: {
main: './src/index.js'
},
output: {
filename: 'assets/[name].js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
devServer: {
port:9000,
index: 'index.htm',
host: 'hello.local'
},
module: {
rules: [
{
test: /\.vue$/,
use: [
'vue-loader'
]
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /\.pug$/,
use: [
'pug-loader'
]
}
]
},
plugins: [
new MiniCssExtractPlugin(),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
template: './src/index.pug',
filename: 'index.htm',
inject: true
})
]
}
Plan was to extract CSS later so unsure why this didn’t work with the original config. If anyone can guide me to the reason, that would be great!
Source:stackexchange.com