Skip to content

Mapilary-js cant be imported in React Router 7 (Vite 5.4.11) #623

@chanan

Description

@chanan

Basic information

MapillaryJS version: "mapillary-js": "^4.1.2",
System/Browser: Mac OS, Node 22.11.0

Steps to Reproduce Behavior

  1. Create a project using react router 7 (Vite 5.4.11)
  2. Add mapillary-js
  3. Import { Viewer, ViewerOptions }
  4. Try to run project

Expected behavior

Project runs

Actual behavior

Internal server error: [vite] The requested module 'mapillary-js' does not provide an export named 'ViewerOptions'
      at analyzeImportedModDifference (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52053:15)
      at nodeImport (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53060:5)
      at ssrImport (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52914:16)
      at eval (/Users/chanan/work/list_test_cli/maps/app/components/map/import.js:3:44)
      at instantiateModule (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)

Additional information

If the import is changed to only import Viewer then that too fails:

Internal server error: [vite] The requested module 'mapillary-js' does not provide an export named 'Viewer'
      at analyzeImportedModDifference (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52053:15)
      at nodeImport (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53060:5)
      at ssrImport (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52914:16)
      at eval (/Users/chanan/work/list_test_cli/maps/app/components/map/index.tsx:7:31)
      at instantiateModule (file:///Users/chanan/work/list_test_cli/maps/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions