webpack React is not defined

 

const path = require("path");

const HtmlWebpackPlugin = require('html-webpack-plugin');

const webpack = require('webpack');

module.exports = {
    ...
    plugins: [
        new webpack.ProvidePlugin({
            "React": "react",
        }) //添加这句
    ]
    ...
};

相关问答