到达路由器-找不到模块'./src/data'

时间:2019-12-02 19:23:00

标签: javascript webpack reach-router

我使用了react-router-dom 5.1.2,现在我想切换到https://www.npmjs.com/package/@reach/router到达路由器(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';

有人可以在这里帮忙吗?

0 个答案:

没有答案