Although the css and js files exist in the path, the following error is output. How to solve it?
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry : './src/index.js',
output : {
filename: "main.js",
path: path.resolve(__dirname,"dist"),
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
//use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /\.jpg$/,
use: ["file-loader"],
},
],
},
plugins : [new HtmlWebpackPlugin({
template: './index.html',
}),
new MiniCssExtractPlugin({
filename: "common.css",
}),
],
devServer : {
static : {
directory : path.resolve(__dirname,'dist'
)
},
port: 8080,
},
};
Refused to apply style from 'http://localhost:8080/src/css/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. localhost/:10 GET http://localhost:8080/src/js/main.js net::ERR_ABORTED 404 (Not Found) index.js:551 [webpack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled. log.js:24 [HMR] Waiting for update signal from WDS...