我使用了 react-router-dom 5.1.2,现在我想切换到https://www.npmjs.com/package/@reach/router Reach 路由器(1.2.1)。
我将它添加到依赖项中并做到了:
const Home = () => (
<div>
<h2>Welcome</h2>
</div>
);
<Router>
<Home path="/" />
</Router>
现在我收到以下错误:
ERROR in ./src/polyfill.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module './src/data'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\standard\Desktop\reactjs-quick\reactjs-template\node_modules\core-js-compat\helpers.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
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.<anonymous> (C:\Users\standard\Desktop\reactjs-quick\reactjs-template\node_modules\core-js-compat\get-modules-list
-for-target-version.js:2:51)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
@ multi webpack/hot/only-dev-server react-hot-loader/patch ./src/main.less ./src/polyfill.js ./src/main.jsx main[3]
我的 polyfill.js 看起来像这样:
import 'core-js/stable';
有人可以帮忙吗?