简体   繁体   English

Materialui升级“您可能需要适当的加载程序来处理此文件类型。”问题

[英]Materialui upgrade “You may need an appropriate loader to handle this file type.” issue

I'm very new to React, Webpack, Babel and web development as well. 我对React,Webpack,Babel和Web开发也很陌生。 The company I work for asked me to upgrade material-ui for the use of search in a dropdown component. 我工作的公司要求我升级material-ui以便在下拉组件中使用搜索。 However, the project is old and the material-ui version was used in the project is "1.0.0-beta.43". 但是,该项目较旧,该项目中使用的material-ui版本为“ 1.0.0-beta.43”。 I upgraded it to "@material-ui/core": "^1.0.0" for starters, didn't want to upgrade to the latest version as it's dependencies could ruin all project. 我将其升级为“ @ material-ui / core”:初学者为“ ^ 1.0.0”,由于其依赖项可能会破坏所有项目,因此不想升级至最新版本。 I saw the @babel/runtime": "^7.1.2 dependency and installed it too. 我看到了@ babel / runtime“:” ^ 7.1.2依赖项,并且也安装了它。 And now when I try to run the project I get the error below, what should I do to solve this? 现在,当我尝试运行项目时,出现以下错误,该怎么办才能解决此问题? I would really appreciate the help. 我非常感谢您的帮助。

ERROR in ./src/main.js Module parse failed: C:\\Work\\STYS_Frontend\\src\\main.js Unexpected token (109:16) You may need an appropriate loader to handle this file type. ./src/main.js中的错误模块解析失败:C:\\ Work \\ STYS_Frontend \\ src \\ main.js意外的令牌(109:16)您可能需要适当的加载程序来处理此文件类型。

The line that's mentioned in the error is ReactDOM.render(, document.getElementById("content")); 错误中提到的行是ReactDOM.render(,document.getElementById(“ content”)));

My package.json and webpack config attached and I have .babelrc in the root document which looks like: 附加了我的package.json和webpack配置,并且根文档中有.babelrc,如下所示:

{ "presets": ["es2015", "stage-0", "react"] }

webpack.config.js webpack.config.js

package.json 的package.json

Since you have install @babel/runtime, you need to update or install 由于已安装@ babel / runtime,因此需要更新或安装

@babel/core,
@babel/plugin-proposal-class-properties,
@babel/plugin-syntax-dynamic-import,
@babel/plugin-transform-runtime,
@babel/preset-env,
@babel/preset-react,
@babel/preset-stage-0,

And for your .babelrc 对于你的.babelrc

{
 "presets": ["@babel/preset-env", "@babel/preset-react" ],
 "plugins": [
 "@babel/plugin-proposal-class-properties",
 "@babel/plugin-syntax-dynamic-import",
 "@babel/plugin-transform-runtime"
 ]
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您可能需要一个合适的加载器来处理这种文件类型。 ReactJs - You may need an appropriate loader to handle this file type. ReactJs JSON 数据对 API 的跨源请求 - “您可能需要一个合适的加载器来处理这种文件类型。” - Cross-Origin Request to API for JSON data - “You may need an appropriate loader to handle this file type.” “npm run build”模块解析错误“您可能需要适当的加载程序来处理此文件类型。” - "npm run build" module parse error "You may need an appropriate loader to handle this file type." react-redux-firebase,“您可能需要适当的加载程序来处理此文件类型。” - react-redux-firebase, “You may need an appropriate loader to handle this file type.” Webpack错误:您可能需要适当的加载程序来处理此文件类型。 | @字符集“ UTF-8”; - Webpack error: You may need an appropriate loader to handle this file type. | @charset “UTF-8”; 模块解析失败:意外的令牌(7:5)您可能需要适当的加载程序来处理此文件类型。 :Webpack,Bootstrap - Module parse failed: Unexpected token (7:5) You may need an appropriate loader to handle this file type. : Webpack, Bootstrap Vue JS 2 on rails 5.1 “您可能需要一个合适的加载器来处理这种文件类型。” - Vue JS 2 on rails 5.1 'You may need an appropriate loader to handle this file type.' Webpack:'你可能需要一个合适的加载器来处理这个文件类型。' - 如何解决异步错误? - Webpack: 'You may need an appropriate loader to handle this file type.' - How to resolve async error? 带有webpack的Kalendar-vue:“您可能需要适当的加载器来处理此文件类型。”嗨 - Kalendar-vue with webpack: “You may need an appropriate loader to handle this file type.”Hi vue-chartjs 你可能需要一个合适的加载器来处理这个文件类型。 错误 - vue-chartjs You may need an appropriate loader to handle this file type. error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM