webpack抱怨找不到模块

时间:2019-07-16 23:32:41

标签: javascript reactjs typescript

我刚刚在我的react应用程序中添加了一个名为@company\core的外部软件包。该外部软件包对aws-sdk

有依赖性

@company\core用打字稿编写,并内置/转换为js。

在npm之后,我的文件夹结构如下

\react-app\node_modules\aws-sdk
\react-app\node_modules\@company\core\node_modules\aws-sdk

但是失败了

import * as Core  from '@company/core';

该错误显示为:

Uncaught Error: Cannot find module 'aws-sdk'
    at webpackEmptyContext (:3000/static/js/main.chunk.js:11)
    at :3000/static/js/17.chunk.js:44252
    at :3000/static/js/17.chunk.js:44231
    at Object.<anonymous> (:3000/static/js/17.chunk.js:44239)
    at Object../node_modules/@company/core/lib/index.js (:3000/static/js/17.chunk.js:44438)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Module../src/utilities/amplifyInit.js (:3000/static/js/main.chunk.js:3118)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Module../src/App.js (:3000/static/js/main.chunk.js:121)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Module../src/index.js (:3000/static/js/main.chunk.js:2470)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at fn (:3000/static/js/bundle.js:150)
    at Object.0 (:3000/static/js/main.chunk.js:3284)
    at __webpack_require__ (:3000/static/js/bundle.js:787)
    at checkDeferredModules (:3000/static/js/bundle.js:46)
    at Array.webpackJsonpCallback [as push] (:3000/static/js/bundle.js:33)
    at :3000/static/js/main.chunk.js:1

为什么aws-sdk不可见?有想法吗?

0 个答案:

没有答案
相关问题