question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with modules starting with @

See original GitHub issue

I’m trying to use Fable with turfjs but the problem is that the package start with @ (@turf/turf) hence the ts2fable generates invalid F# code like

// ts2fable 0.6.1
module rec ModuleName
open System
open Fable.Core
open Fable.Import.JS

let [<Import("*","module")>] ``@turf/along``: @turf_along.IExports = jsNative
// many more similar lines 

There exists old package with definition file for turf without the @'s and F# produces no errors but fable complains following while I want to call turf.point( cords) ERROR in ./src/App.fs Module not found: Error: Can’t resolve ‘module’ in …

Do I have to somehow instruct fable that it should point to specific node module (turfjs here)? I’m using the minimal fable template

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MangelMaximecommented, Nov 9, 2018

You need to replace module probably by @turf/along in let [<Import("*","module")>]

0reactions
citymeteriocommented, Nov 9, 2018

It is working but I still have some obstacles not knowing it is the lack of my experience with those tools or the binding inaccuracy problem. Following is compiling only with the casting as turf.featureCollection returns ‘obj option’ instead of ‘Point’

//bikes is my array of lat/lon records
let data = bikes |> Array.map (fun bike -> turf.point(!!ResizeArray([bike.lat; bike.lon] )))
let cords = ResizeArray([51.12;17.01])
let myPoint = turf.point(!!cords)

let bikesCollection = turf.featureCollection(!!data) :?> FeatureCollection<Point>
let nearest = turf.nearest(myPoint, bikesCollection) 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Use of @ symbol in Node module names [duplicate]
Scoped packages in npm are preceded by an '@' symbol. A scope allows you to create a package with the same name as...
Read more >
Common TypeScript module problems and how to solve ...
Avoid common problems in build processes in TypeScript using the TypeScript compiler and module system.
Read more >
Why Can't Python Find My Modules?
A common error that new Pythonistas will come across is that the packages they think they've installed are not actually being recognized by...
Read more >
How to resolve "Cannot find module" error in Node
The issue is that Node is unable to find the module that you are trying to import into your Node application. The most...
Read more >
Error: cannot find module [Node npm Error Solved]
In my case, I got it like this "Module not found: Error: Can't resolve 'react-icons/fa' in 'C:\Users\user\Desktop\Projects\Address Locator\ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found