我根据文档上的设置指南设置了玩笑(尽管我在使用create-react-app时遇到了这个问题,所以我认为这与玩笑的配置无关)
在我的一项测试中,我正从@react-google-maps/api
库(我是其维护者之一)中导入组件:
import { LoadScript, GoogleMap } from "@react-google-maps/api"
,并且在运行测试时出现错误:
Cannot find module '@react-google-maps/api' from 'app.spec.js'
仅出于笑话,我就可以将这些组件导入其他任何地方。
其他信息:
@react-google-maps/api
库的package.json
中包含以下字段:
"browser": "lib/index.js",
"module": "lib/index.js",
和index.js看起来像这样:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GoogleMap_1 = require("./GoogleMap");
exports.GoogleMap = GoogleMap_1.default;
var LoadScript_1 = require("./LoadScript");
exports.LoadScript = LoadScript_1.default;
var TrafficLayer_1 = require("./components/maps/TrafficLayer");
exports.TrafficLayer = TrafficLayer_1.default;
var BicyclingLayer_1 = require("./components/maps/BicyclingLayer");
exports.BicyclingLayer = BicyclingLayer_1.default;
var DrawingManager_1 = require("./components/drawing/DrawingManager");
exports.DrawingManager = DrawingManager_1.default;
var Marker_1 = require("./components/drawing/Marker");
exports.Marker = Marker_1.default;
var MarkerClusterer_1 = require("./components/addons/MarkerClusterer");
exports.MarkerClusterer = MarkerClusterer_1.default;
var InfoWindow_1 = require("./components/drawing/InfoWindow");
exports.InfoWindow = InfoWindow_1.default;
var Polyline_1 = require("./components/drawing/Polyline");
exports.Polyline = Polyline_1.default;
var Polygon_1 = require("./components/drawing/Polygon");
exports.Polygon = Polygon_1.default;
var Rectangle_1 = require("./components/drawing/Rectangle");
exports.Rectangle = Rectangle_1.default;
var Circle_1 = require("./components/drawing/Circle");
exports.Circle = Circle_1.default;
var Data_1 = require("./components/drawing/Data");
exports.Data = Data_1.default;
var KmlLayer_1 = require("./components/kml/KmlLayer");
exports.KmlLayer = KmlLayer_1.default;
var OverlayView_1 = require("./components/dom/OverlayView");
exports.OverlayView = OverlayView_1.default;
var GroundOverlay_1 = require("./components/overlays/GroundOverlay");
exports.GroundOverlay = GroundOverlay_1.default;
var HeatmapLayer_1 = require("./components/heatmap/HeatmapLayer");
exports.HeatmapLayer = HeatmapLayer_1.default;
var StreetViewPanorama_1 = require("./components/streetview/StreetViewPanorama");
exports.StreetViewPanorama = StreetViewPanorama_1.default;
var StreetViewService_1 = require("./components/streetview/StreetViewService");
exports.StreetViewService = StreetViewService_1.default;
var DirectionsService_1 = require("./components/directions/DirectionsService");
exports.DirectionsService = DirectionsService_1.default;
var DirectionsRenderer_1 = require("./components/directions/DirectionsRenderer");
exports.DirectionsRenderer = DirectionsRenderer_1.default;
var StandaloneSearchBox_1 = require("./components/places/StandaloneSearchBox");
exports.StandaloneSearchBox = StandaloneSearchBox_1.default;
var Autocomplete_1 = require("./components/places/Autocomplete");
exports.Autocomplete = Autocomplete_1.default;
我的库是否缺少任何正在寻找的配置?
谢谢!
乌里