javascript - 使用 Webpack 运行我的 React 应用程序的问题
问题描述
这段代码是我的 webpack.config.js 文件。
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./src/index.js",
output: {
path: path.join(__dirname, "./dist"),
publicPath: '/dist/',
filename: "index_bundle.js"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
},
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/index.html"
})
],
devServer: {
publicPath: '/dist/'
}
};
附件是我的错误信息。
我尝试重新安装一些软件包并从 starterkit 修改此配置文件,但无济于事。
提前致谢!
解决方案
推荐阅读
- javascript - Getting TypeError Arg 1 when calling save method of jsPDF
- python - 无法将 CSS 应用于 GtkEntry 小部件(GTK3 / gi / Python)不工作
- r - 如果不符合某些条件,则将多维数组中的所有值设置为 0
- python - 最后一个子进程调用在 FFMPEG 的串联代码中不起作用。我应该如何解决这个问题?
- django - 如何在 Django Admin 中对外部字段启用列排序
- java - 带有按钮的 Swing JPanel 无法重绘
- python - sys.exc_info() 的目的是什么?
- macos - 在 macOS Catalina 上无法识别 Conda 命令
- javascript - 如何在 Vue 中调用可重用组件上的方法
- angular - 配置我的应用程序以阻止它重写 URL?