How to import external NPM libraries into custom functions? #2210
Unanswered
antonio-jara-db
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I'm trying to validate API definitions are written in English, so I decided to implement one custom function.
This JavaScript code will use "franc" NPM library (https://www.npmjs.com/package/franc) to detect the language of the input data.
npm install and so on, but when trying to validate the API definition, it ends with connectivity problems.
Error inside Spectral output log:
_FetchError: Could not load https://cdn.skypack.dev/franc (imported by functions\english.js): request to https://cdn.skypack.dev/franc failed, reason: connect ETIMEDOUT_
I'm behind a proxy, but we have an internal NPM registry which can be used to download dependencies.
Am I missing something? Any help would be very appreciated, thanks a lot! 😄
Custom function english.js source code:
Configuration in .spectral.yaml file:
Beta Was this translation helpful? Give feedback.
All reactions