导入模块中的 F# Fable 函数未编译到 js 中
F# Fable function from imported module is not compiled into js
我使用安全堆栈。对于电子邮件验证,我通过 paket 导入了 EmailValidation。代码编译和运行s;我什至可以通过调试器查看 EmailValidation 源代码。在 运行 时我遇到异常:
Uncaught ReferenceError: EmailValidation_EmailValidator_Validate_C556D7B is not defined
at isEmailAndPasswordValid (Index.fs.js?b47d:47)
at containerBox (Index.fs.js?b47d:184)
at view (Index.fs.js?b47d:216)
at eval (App.fs.js?8a0c:24)
at eval (Util.js?2ca6:555)
at uncurriedFn (Util.js?2ca6:520)
at Object.eval [as render] (common.fs.js?a3d0:73)
at Components_LazyView.render (common.fs.js?a3d0:56)
at finishClassComponent (react-dom.development.js?db4e:17160)
at updateClassComponent (react-dom.development.js?db4e:17110)
在浏览器中导航到源代码:
export function isEmailAndPasswordValid(data) {
const em = EmailValidation_EmailValidator_Validate_C556D7B(data.Email, false, false);
const p = !isNullOrWhiteSpace(data.Password);
if (em) {
return p;
}
else {
return false;
}
}
我的 F# 代码:
let isEmailAndPasswordValid (data: LoginInfo)=
let em = EmailValidation.EmailValidator.Validate data.Email
//let em = String.IsNullOrWhiteSpace data.Email |> not
let p = String.IsNullOrWhiteSpace data.Password |> not
em && p
当我使用简单的 String.IsNullOrWhiteSpace 时,一切都很好。
为什么我不能在寓言中使用导入代码?
根据 the docs:
Please note that not all Nuget libraries will work with Fable. Refer to the library documentation to check if it's Fable-compatible.
兼容库 amongst other things 需要将其 F# 源代码包含在 NuGet 包中,以便 Fable 可以将其转换为 JavaScript。
据我所知,EmailValidation
是用 C# 编写的,所以这行不通。
我使用安全堆栈。对于电子邮件验证,我通过 paket 导入了 EmailValidation。代码编译和运行s;我什至可以通过调试器查看 EmailValidation 源代码。在 运行 时我遇到异常:
Uncaught ReferenceError: EmailValidation_EmailValidator_Validate_C556D7B is not defined
at isEmailAndPasswordValid (Index.fs.js?b47d:47)
at containerBox (Index.fs.js?b47d:184)
at view (Index.fs.js?b47d:216)
at eval (App.fs.js?8a0c:24)
at eval (Util.js?2ca6:555)
at uncurriedFn (Util.js?2ca6:520)
at Object.eval [as render] (common.fs.js?a3d0:73)
at Components_LazyView.render (common.fs.js?a3d0:56)
at finishClassComponent (react-dom.development.js?db4e:17160)
at updateClassComponent (react-dom.development.js?db4e:17110)
在浏览器中导航到源代码:
export function isEmailAndPasswordValid(data) {
const em = EmailValidation_EmailValidator_Validate_C556D7B(data.Email, false, false);
const p = !isNullOrWhiteSpace(data.Password);
if (em) {
return p;
}
else {
return false;
}
}
我的 F# 代码:
let isEmailAndPasswordValid (data: LoginInfo)=
let em = EmailValidation.EmailValidator.Validate data.Email
//let em = String.IsNullOrWhiteSpace data.Email |> not
let p = String.IsNullOrWhiteSpace data.Password |> not
em && p
当我使用简单的 String.IsNullOrWhiteSpace 时,一切都很好。 为什么我不能在寓言中使用导入代码?
根据 the docs:
Please note that not all Nuget libraries will work with Fable. Refer to the library documentation to check if it's Fable-compatible.
兼容库 amongst other things 需要将其 F# 源代码包含在 NuGet 包中,以便 Fable 可以将其转换为 JavaScript。
据我所知,EmailValidation
是用 C# 编写的,所以这行不通。