reactjs - GD 7.2.0 to 7.4.0 library upgrade issues
问题描述
We are upgrading our GoodData library to 7.4.0 (from 7.2.0) and the error we are getting in our build is:
0=./node_modules/react-intl/lib/components/provider.js 59:15
Module parse failed: Unexpected token (59:15)
File was processed with these loaders:
* ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js
You may need an additional loader to handle the result of these loaders.
| return Object.assign(Object.assign({}, resolvedConfig), { formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatHTMLMessage: formatHTMLMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
| }
> export default const IntlProvider = /*@__PURE__*/ function () {
| class IntlProvider extends React.PureComponent {
| constructor() {
@ ./node_modules/react-intl/lib/index.js 7:0-76 7:0-76 7:0-76
@ ./node_modules/@gooddata/react-components/dist/helpers/IntlStore.js
@ ./node_modules/@gooddata/react-`enter code here`components/dist/components/filters/DateFilter/utils/Translations/DateFilterTitle.js
@ ./node_modules/@gooddata/react-components/dist/components/filters/DateFilter/index.js
@ ./node_modules/@gooddata/react-components/dist/index.js
@ ./.skypagestmp/src/app/public/src/modules/gooddata-chart/gooddata-chart.component.js
@ ./.skypagestmp/src/app/sky-pages.module.ngfactory.js
@ ./.skypagestmp/src/app/app.module.ngfactory.js
@ ./.skypagestmp/src/main-internal.aot.ts
@ multi ./.skypagestmp/src/main-internal.aot.ts
解决方案
从错误消息看来,问题出在react-intl
,从2.4.0
in升级@gooddata/react-components@7.2.0
到3.6.0
in @gooddata/react-components@7.4.0
。不幸的是,从 v2 升级到 v3 时,react-intl 在某些情况下需要进行一些迁移。
最有可能的是,您需要将以下配置添加到您的 babel-loader(或 typescript-loader)配置中,如升级指南react-intl
中所述,将库包含到您的构建过程中:
include: [
path.join(__dirname, "node_modules/react-intl"),
path.join(__dirname, "node_modules/intl-messageformat"),
path.join(__dirname, "node_modules/intl-messageformat-parser"),
],
推荐阅读
- regex - 正则表达式(PCRE):匹配包含某个字符串的行之后的行中的所有数字
- git - Github 更改文件夹大小写
- python - python函数在许多文件上打印到stdOut
- python - 创建一个包含多个数据类实例的 Python 列表
- android - MoPub 在使用测试广告单元 ID 时未找到任何广告
- python - overrideredirect 如何影响 winfo_height/width?
- oracle - Oracle 过程从表中选择数据,从 all_tab_columns 传递列
- c++ - 重载 >> 运算符时的非法指令
- python - 递归地打乱列表
- php - PHP通过带有stdObjects的多维数组进行多次循环