javascript - webpack 抱怨找不到模块
问题描述
@company\core
我刚刚添加了一个名为我的反应应用程序的外部包。该外部包依赖于aws-sdk
@company\core
用打字稿编写并构建/转译成 js。
在 npm i 之后,文件夹结构如下所示
\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 是不可见的?任何想法?
解决方案
推荐阅读
- python - 解压熊猫数据框的一部分
- java - 如何将错误格式的字符串转换为 JSONObject
- spring-boot - Swagger UI 重定向到 /swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config
- c# - Xamarin:从我在 xamarin 移动项目中创建的文件夹中获取文件
- c++ - QDataStream 读取到 QVector
- gnome - libgsf - 按名称的子级仅返回 GsfInput
- r - R中的茎叶图分组
- python - 用熊猫遍历数据框并替换字符
- javascript - 如何在单击功能下捕获多个按钮并将内容发送到本地存储
- java - 有没有办法扩展 fxml 控制器