Parsing 模块分析失败…当前没有配置加载程序来处理此文件?
我正在Amazon上开发kindlebook——React项目:使用Roy Derks的React、React Native和React 360从头开始构建12个真实世界的应用程序,我正在进行第一个项目。我是React的n00b。我被终端上这个丑陋的错误信息困住了。我试着按照这本书的要求去做,但是我不知道如何修复它Parsing 模块分析失败…当前没有配置加载程序来处理此文件?,parsing,webpack,module,babeljs,Parsing,Webpack,Module,Babeljs,我正在Amazon上开发kindlebook——React项目:使用Roy Derks的React、React Native和React 360从头开始构建12个真实世界的应用程序,我正在进行第一个项目。我是React的n00b。我被终端上这个丑陋的错误信息困住了。我试着按照这本书的要求去做,但是我不知道如何修复它 > webpack --mode development asset main.js 1.5 KiB [compared for emit] (name: main) ass
> webpack --mode development
asset main.js 1.5 KiB [compared for emit] (name: main)
asset ./index.html 379 bytes [compared for emit]
./src/index.js 183 bytes [built] [code generated] [1 error]
ERROR in ./src/index.js 5:10
Module parse failed: Unexpected token (5:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| const App = () => {
> return<h1>MovieList</h1>;
|
| };
非常感谢您的帮助
const HtmlWebPackPlugin = require("html-webpack-plugin");
const path = require("path");
const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html",
});
module.exports = {
devServer: {
contenentBase: path.resolve(__dirname, "./src"),
historyApiFallback: true
},
entry: path.resolve(__dirname, "./src/index.js"),
module: {
rules: [
{
test: "/\.js$/",
exclude: "/node_modules/",
use: {
loader: '@babel-reactnp',
},
},
],
},
plugins: [htmlPlugin],
};