【问题标题】:Using alias in ParcelJS在 ParcelJS 中使用别名
【发布时间】:2019-06-21 16:57:48
【问题描述】:

我正在尝试使用 ParcelJs 作为捆绑器将“react-native”别名为“react-native-web”。

在 package.json 中别名定义为:

“别名”:{ “反应原生”:“反应原生网络” }

在运行项目时,会产生以下错误。

    $ parcel src/Index.html --open
Server running at http://localhost:1234
????  /Users/prisc_000/Downloads/parcel-bundler-reason-react-native-web/node_modules/bs-react-native/src/components/view.js:5:26: Cannot resolve dependency 'react-native'
  3 |
  4 | var ReasonReact = require("reason-react/src/ReasonReact.js");
> 5 | var ReactNative = require("react-native");
    |                          ^
  6 | var Props$BsReactNative = require("../private/props.js");
  7 |
  8 | function CreateComponent(Impl) {
^C

如何正确设置别名?谢谢。

示例代码库:https://github.com/idkjs/parcel-bundler-reason-react-native-web/tree/react-native-web

【问题讨论】:

    标签: alias parceljs


    【解决方案1】:

    所以我通过删除 .cache 和 lib 目录并再次运行 parcel src/index.html --open 脚本来实现这一点。希望这对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2019-05-31
      • 2020-11-03
      • 2019-01-31
      • 2018-06-09
      • 2018-10-05
      • 2018-06-30
      • 2019-10-14
      • 2018-12-05
      • 2012-03-07
      相关资源
      最近更新 更多