facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
229.21k stars 46.94k forks source link

antd V3升级V4,启动后报错 #22430

Closed xhb03 closed 3 years ago

xhb03 commented 3 years ago

× TypeError: Object(...) is not a function ./node_modules/@ant-design/icons/es/components/Context.js D:/SourceCode/id-track-frontend/node_modules/@ant-design/icons/es/components/Context.js:2 1 | import { createContext } from 'react';

2 | var IconContext = /#PURE/createContext({}); 3 | export default IconContext; 4 | 5 | View compiled webpack_require D:/SourceCode/id-track-frontend/webpack/bootstrap 42c230ef9f100b29add9:707 704 | }; 705 | 706 | // Execute the module function 707 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 708 | 709 | // Flag the module as loaded 710 | module.l = true; View compiled fn D:/SourceCode/id-track-frontend/webpack/bootstrap 42c230ef9f100b29add9:112 109 | console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId); 110 | hotCurrentParents = []; 111 | } 112 | return webpack_require(request); 113 | }; 114 | var ObjectFactory = function ObjectFactory(name) { 115 | return { View compiled ./node_modules/@ant-design/icons/es/index.js D:/SourceCode/id-track-frontend/node_modules/@ant-design/icons/es/index.js:1 1 | import Context from './components/Context'; 2 | export from './icons'; 3 | export from './components/twoTonePrimaryColor'; 4 | export { default as createFromIconfontCN } from './components/IconFont'; View compiled webpack_require D:/SourceCode/id-track-frontend/webpack/bootstrap 42c230ef9f100b29add9:707 704 | }; 705 | 706 | // Execute the module function 707 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 708 | 709 | // Flag the module as loaded 710 | module.l = true; View compiled fn D:/SourceCode/id-track-frontend/webpack/bootstrap 42c230ef9f100b29add9:112 109 | console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId); 110 | hotCurrentParents = []; 111 | } 112 | return webpack_require(request); 113 | }; 114 | var ObjectFactory = function ObjectFactory(name) { 115 | return {./src/components/message/Notice.jsx D:/SourceCode/id-track-frontend/src/components/message/Notice.jsx:2 1 | import React, { PureComponent } from 'react' 2 | import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons'; 3 | import { observe, observable } from 'mobx' 4 | import { observer } from 'mobx-react' 5 | import './style' View compiled ▶ 2 stack frames were collapsed. ./src/containers/index/Layout.jsx D:/SourceCode/id-track-frontend/src/containers/index/Layout.jsx:3 1 | import React, { PureComponent } from 'react' 2 | import { observer, inject } from 'mobx-react' 3 | import Message from '../../components/message/Notice' 4 | 5 | const style = { 6 | height: '100%', View compiled ▶ 2 stack frames were collapsed. ./src/routes/index.js D:/SourceCode/id-track-frontend/src/routes/index.js:3 1 | import React from 'react' 2 | import { Router, hashHistory } from 'react-router' 3 | import Layout from 'containers/index/Layout' 4 | 5 | const rootRoute = { 6 | path: '/', View compiled ▶ 2 stack frames were collapsed. ./src/App.js D:/SourceCode/id-track-frontend/src/App.js:2 1 | import React, { PureComponent } from 'react' 2 | import routes from './routes' 3 | import {Provider} from 'mobx-react' 4 | import store from 'store' 5 | import { ConfigProvider } from 'antd'; View compiled ▶ 2 stack frames were collapsed. ./src/index.js D:/SourceCode/id-track-frontend/src/index.js:3 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import App from './App' 4 | // import 'antd/dist/antd.css' 5 | import registerServiceWorker from './registerServiceWorker' 6 | View compiled ▶ 6 stack frames were collapsed. This screen is visible only in development. It will not appear if the app crashes in production. Open your browser’s developer console to further inspect this error.

bvaughn commented 3 years ago

This bug should be filed in the @ant-design repo.