Webpack package react, error its MIME type ('text/html') is not executable

< H1 > github address < / H1 >

error will be reported when using npm run dev

const path = require("path");
const merge = require("webpack-merge");
const common = require("./webpack.common.js");
// dev-server
let BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;

module.exports = merge(common, {

    output: { //
        //filename: "[name].bundle.js", //
        // filename: "[name].[chunkhash].js",
        // __dirname
        path: path.resolve(__dirname, "./public"), //
        publicPath:"dist/", // publicPath
        filename: "./dist/[name].bundle.js",
        chunkFilename: "./dist/[name].bundle.js"
    },
    devtool: "source-map",
    devServer: {
        contentBase: [path.join(__dirname, "./public")], //   
        host: "127.0.0.1",
        compress: true,
        port: 6600,
        open: false // 
    },
    plugins:[
        new BundleAnalyzerPlugin({
            analyzerMode: "server", // static/disabled
            analyzerHost: "127.0.0.1",
            analyzerPort: 9900,
            openAnalyzer: false
        })
    ]
});

Feb.26,2021

did you set the html file to entry?


have you solved it? I used webpack to package vue with the same problem


I also encountered the same problem. I couldn't find a solution, so I'm in a hurry!

Menu