websemantics / awesome-ant-design

A curated list of Ant Design resources and related projects. The main idea is that everyone can contribute here, so we can have a central repository of informations about Ant Design that we keep up-to-date
http://ant.design/
Other
3.13k stars 215 forks source link

引用国际化中文包报语法错误 #47

Open Greatwallycc opened 4 years ago

Greatwallycc commented 4 years ago

写法是这样的:https://codesandbox.io/embed/antd-reproduction-template-pyg3j

报错如下: (node:99704) UnhandledPromiseRejectionWarning: D:\学习\React\EDS\node_modules\antd\es\locale\zh_CN.js:1 import Pagination from "rc-pagination/es/locale/zh_CN"; ^^^^^^^^^^

SyntaxError: Unexpected identifier at Module._compile (internal/modules/cjs/loader.js:723:23) at Module._compile (D:\学习\React\EDS\node_modules\pirates\lib\index.js:99:24) at Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Object.newLoader [as .js] (D:\学习\React\EDS\node_modules\pirates\lib\index.js:104:7) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (D:\学习\React\EDS\src\ssr/App.js:5:1) (node:99704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:99704) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

ctrl+点击可以跳转到文件,路径是没问题的,再说这事antd内部引用的啊,也不是babel的问题,其他的引用编译就没问题。。

Greatwallycc commented 4 years ago

import React from 'react'; import PropTypes from 'prop-types'; import {Provider} from 'react-redux'; import {ConfigProvider} from 'antd'; import zhCN from 'antd/es/locale/zh_CN'; // import zhCN from 'antd/lib/locale-provider/zh_CN'; import {hot} from 'react-hot-loader/root'; import getStore from './store';

class App extends React.PureComponent {

render () { return (

{this.props.children ||

There is nothing!

}
)

} }

export default hot(App);