milespratt / bingmaps-react

An easy to use Bing Maps React component.
https://bingmaps-react.netlify.app
MIT License
21 stars 19 forks source link

Cannot find module 'bingmaps-react' or its corresponding type declarations.ts(2307) #36

Closed sharief-acc closed 2 years ago

sharief-acc commented 2 years ago

Install the latest version 1.1.1 and getting the error --> Cannot find module 'bingmaps-react' or its corresponding type declarations.ts(2307) import BingMapsReact from "bingmaps-react";

AvinashDalvi89 commented 2 years ago

package shows in node_modules ?

jimmywim commented 2 years ago

I think you're missing an index.js on your published npm package.

Gotta import with:

import BingMapsReact from "bingmaps-react/BingMapsReact";

milespratt commented 2 years ago

@sharief-acc @jimmywim are you both using typescript? This package wasn't built with typescript in mind but it's on the roadmap and I'm happy to look into the issue.

I just created a fresh react app with version 1.1.1 and am not having issues installing or using the package as follows:

npm install bing maps-react

import "./App.css";
import BingMapsReact from "bingmaps-react";

function App() {
  return (
    <div className="App">
      <BingMapsReact />
    </div>
  );
}

export default App;

node_modules shows the files as expected:

Screen Shot 2021-12-02 at 10 45 10 AM
milespratt commented 2 years ago

I just published a new version, 1.1.4, that may resolve your issues. Please let me know.

milespratt commented 2 years ago

@sharief-acc @jimmywim I added some simple TS support via some minimal declarations. I expect this to work in TS apps without any hassle now.