- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在升级 Babel 6 项目 (6.14.0),在运行 Babel 升级程序 (npx babel-upgrade --write
) 后我遇到了问题
我已经运行了 npm install @babel/helper-module-imports
但是,似乎根本没有解决任何问题。
我收到的错误消息如下:(但是对于每个单独的组件......其中有很多)
./src/components/TableData/index.js 中的错误模块构建失败:错误:src/components/TableData/index.js:此 API 已被删除。如果你在 Babel 7 中寻找这个功能,你应该导入 '@babel/helper-module-imports' 模块并使用从该模块公开的函数,例如 'addNamed' 或 'addDefault'。
关于如何解决这个问题的任何指南?或者应该去哪里看? (我已经安装了这个包,但没有运气......尝试删除 package.lock.json 和 node_modules,没有运气。)
Package.JSON:
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@babel/runtime-corejs2": "^7.0.0",
"@carbon/icons-react": "^10.3.0",
"axios": "^0.16.2",
"axios-retry": "^3.1.8",
"body-parser": "1.15.2",
"bootstrap": "^3.4.1",
"bootstrap-social": "^5.1.1",
"carbon-components": "^10.3.0",
"carbon-components-react": "^7.3.0",
"carbon-icons": "^7.0.7",
"chart.js": "^2.6.0",
"cookie-parser": "1.4.3",
"eslint-config-prettier": "^6.11.0",
"eslint-config-react-app": "^5.2.1",
"eslint-plugin-prettier": "^3.1.4",
"eventemitter3": "1.2.0",
"express": "4.14.0",
"express-jwt": "3.4.0",
"fastclick": "1.0.6",
"fbjs": "0.8.4",
"font-awesome": "^4.7.0",
"history": "3.0.0",
"isomorphic-style-loader": "1.0.0",
"jquery": "^3.1.1",
"js-cookie": "^2.2.1",
"material-ui": "^0.19.4",
"material-ui-chip-input": "^0.18.2",
"moment": "^2.24.0",
"node-fetch": "1.6.0",
"normalize.css": "4.2.0",
"pretty-error": "2.0.0",
"react": "^16.8.3",
"react-bootstrap": "^0.32.4",
"react-bootstrap-table": "^4.3.1",
"react-bootstrap-typeahead": "^3.3.5",
"react-chartjs-2": "^2.7.4",
"react-chat-ui": "^0.3.2",
"react-collapsible": "^2.6.0",
"react-dom": "^16.8.3",
"react-jsonschema-form": "^1.8.1",
"react-redux": "^7.2.0",
"react-select": "^2.4.1",
"react-table": "^6.9.2",
"redux": "^4.0.4",
"redux-saga": "^1.0.2",
"source-map-support": "^0.4.18",
"universal-router": "1.2.2",
"whatwg-fetch": "1.0.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/helper-module-imports": "^7.10.4",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-react-constant-elements": "^7.0.0",
"@babel/plugin-transform-react-inline-elements": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/template": "^7.0.0",
"@babel/types": "^7.0.0",
"assets-webpack-plugin": "^3.4.0",
"autoprefixer": "^6.4.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-loader": "7.1.1",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-rewire": "^1.0.0-rc-7",
"babel-preset-node5": "^11.1.0",
"browser-sync": "^2.14.3",
"chai": "^3.5.0",
"css-loader": "^0.24.0",
"del": "^2.2.2",
"enzyme": "^2.4.1",
"eslint": "^7.5.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-loader": "^1.5.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"extend": "^3.0.0",
"file-loader": "^0.9.0",
"gaze": "^1.1.1",
"git-repository": "^0.1.4",
"glob": "^7.0.6",
"json-loader": "^0.5.4",
"mkdirp": "^0.5.1",
"mocha": "^3.0.2",
"ncp": "^2.0.0",
"pixrem": "^3.0.2",
"pleeease-filters": "^3.0.0",
"postcss": "^5.1.2",
"postcss-calc": "^5.3.1",
"postcss-color-function": "^2.0.1",
"postcss-custom-media": "^5.0.1",
"postcss-custom-properties": "^5.0.1",
"postcss-custom-selectors": "^3.0.0",
"postcss-flexbugs-fixes": "^2.0.0",
"postcss-import": "^8.1.2",
"postcss-loader": "^0.11.1",
"postcss-media-minmax": "^2.1.2",
"postcss-nesting": "^2.3.1",
"postcss-pseudoelements": "^3.0.0",
"postcss-selector-matches": "^2.0.1",
"postcss-selector-not": "^2.0.0",
"prettier": "2.0.5",
"raw-loader": "^0.5.1",
"react-addons-test-utils": "15.5.0",
"react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.4",
"redbox-react": "^1.3.0",
"sinon": "^2.0.0-pre.2",
"stylelint": "^7.2.0",
"stylelint-config-standard": "^13.0.0",
"url-loader": "^0.5.7",
"webpack": "^1.13.2",
"webpack-hot-middleware": "^2.12.2",
"webpack-middleware": "^1.5.1"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"env": {
"test": {
"plugins": [
"rewire"
]
}
},
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-pipeline-operator",
{
"proposal": "minimal"
}
],
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-function-bind",
"@babel/plugin-transform-runtime",
"@babel/plugin-transform-react-inline-elements"
]
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"globals": {
"__DEV__": true
},
"env": {
"browser": true
}
},
"stylelint": {
"extends": "stylelint-config-standard",
"rules": {
"string-quotes": "single",
"property-no-unknown": [
true,
{
"ignoreProperties": [
"composes"
]
}
],
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": [
"global",
"local"
]
}
]
}
},
}
至于表文件,这是一个快照。奇怪的是它过去在升级前运行良好,尽管我们运行了 linter 并添加了片段 short-syntax <>。不确定那是否是精确定位区域。
Table Index content
import React, { Component } from "react";
import ReactDOM from "react-dom";
import axios from 'axios';
import { BACKEND_ROOT_URL } from "../../constants";
import ApplicationsTable from "./applicationsTable";
class TableData extends Component {
constructor(props) {
super(props);
this.state = {
data: [],
total: 0,
isError: false,
errorMessage: "",
};
this.componentDidMount = this.componentDidMount.bind(this);
}
componentDidMount() {
this.getData();
}
getData() {
const currn = this;
axios
.get(`${this.props.url}/all`)
.then((response) => {
currn.setState({
data: response.data,
total: response.data.length,
});
})
.catch(function (error) {
currn.setState({
isError: true,
errorMessage: error.response.data.message,
});
});
}
render() {
return (
<div className="bx--row">
<div className="bx--col-lg-12">
{this.state.isError == true ? (
<h3 className="bx-error-404">{`Error: ${this.state.errorMessage}`}</h3>
) : (
<>
<ApplicationsTable
data={this.state}
/>
</>
)}
</div>
</div>
);
}
}
export default TableAgents;
最佳答案
我能够解决它,问题是包:babel-plugin-react-transform
它是这样被导入的,删除/更新到热加载器解决了它。
希望这对发现这种情况的人有所帮助。
关于reactjs - Babel 7 升级 : @babel/helper-module-imports,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63027676/
link-to帮助程序返回以下错误: Uncaught Error: each doesn't match link-to - 5:10 模板:
默认情况下,ember-cli 生成的帮助程序如下所示: import Ember from 'ember'; export function boundLoc(input) { return i
我正在发现 .Net Core 标签助手,我只是想知道是否有任何标签助手可以复制 @Html.DisplayFor。我认为 label tag helper 复制了 @Html.DisplayName
在本地访问我的 Rails 应用程序时,加载任何页面时出现以下错误: /!\ FAILSAFE /!\ Tue Jul 06 15:08:17 -0500 2010 Status: 500 Inte
m.ResetDayComponent.WeightedAverageMethodID, DropDownData.AveragingMethodList(), "", new { @class =
我正在使用 yii\helpers\Url 助手来访问我网站的菜单中的 url。但是应该有一个 url 去另一个网站,比如 www.anothersite.com/action . 如何通过 yii\
我不确定这是否可能。 我有一堆@Helper位于 View 内以及其他 View 中: @helper ViewHelper1() { ... } @helper ViewHelper2() {
有没有办法在 @helper 声明中访问完整的 @Url 帮助程序对象? 我想做这样的事情...... @helper Button(System.Web.Mvc.ActionResult actio
ASP.Net MVC 6 引入了标签助手功能。 为什么我们应该使用标签助手而不是以前版本提供的 Helper 类? 最佳答案 引入标签助手有几个原因。 Scott Hanselman talks i
我正在尝试从我的 ember.js 应用程序中的另一个助手调用助手,但不知道 blazes 在 2.x 中如何执行此操作。作为引用,我使用 Ember 2.4 和 Ember-CLI。 有几个答案在旧
我想在 Twitter 意图按钮上使用一个图标。 "btn" %> 这可能吗? 页面上还有 2 个其他按钮使用 button_tag 助手,我可以将图标插入到这些按钮中。我应该将 button_to
我一直在基于 Scott Gu's post 在 Razor 中实现一些 @helper 函数,事情进展顺利。 但我想知道的是,是否可以从另一个调用一个 @helper。例如,我有以下助手显示 Dat
我需要创建自定义 html 辅助方法。据我所知有两种方式: 使用@helper razor 语法。 http://weblogs.asp.net/scottgu/archive/2011/05/12/
我刚刚从另一台计算机上克隆了一个我正在使用的存储库。当我尝试通过运行“rake db:migrate”进行数据库迁移时,出现以下错误: AbstractController::Helpers::Mis
我的助手是这样工作的: def some_help(in_string) in_string + " and more" end 但我希望它在输出之前对 执行操作,并且我一直按字面意思获取 字符本
除了在 .Net Core 2 中,我正在尝试解决这个问题。 Can I use a Tag Helper in a custom Tag Helper that returns html? ” 我想
是否可以在另一个 View 助手中使用 View 助手?我们必须查看助手: 帮助我1 use Zend\View\Helper\AbstractHelper; class HelpMe1 extend
Creating MVC3 Razor Helper like Helper.BeginForm() 说它可以使用扩展方法和实现 IDisposable 来完成。可以通过使用声明性 Razor 助手来
所以如果我有一个模板: {{foo}} 和模板助手: Template.myTemplate.foo = function() { blah = Session.get('blah');
我正在尝试为我的 Reddit 机器人运行代码。它可以毫无问题地登录 Reddit,但是当它到达这段代码时,它会抛出一个错误: all_comments = praw.helpers.flatten_
我是一名优秀的程序员,十分优秀!