jest-editor-support icon indicating copy to clipboard operation
jest-editor-support copied to clipboard

When using jest-editor-support from cdn, fails to locate the parse named method

Open cbarrerah opened this issue 2 years ago • 0 comments
trafficstars

Hi there, Maybe it is a silly mistake, but I am trying to use the parse method in one tampermonkey script that I am transpiling with vite-monkey-plugin. The rest of the set up was crazy to get working, but in the end managed to make it work. Now I am trying to use the parse method in one piece of typescript code:

import { parse } from "https://cdn.jsdelivr.net/npm/jest-editor-support/build/index.min.js"; and calling it like:

const parsedSpecFile = parse(path, contents);

When opening the page that calls this code, it complains without even reaching the part of the code that executes this call:

Uncaught SyntaxError: The requested module 'https://cdn.jsdelivr.net/npm/jest-editor-support/build/index.min.js' does not provide an export named 'parse' (at SpecFileItDescription.tsx:8:10)

As far as I understand, the part that actually generates the named export is in index.js on build folder: Object.defineProperty(exports, "parse", { enumerable: true, get: function get() { return _parsers["default"]; } });

And in the browser, it gets rightfully detected as: Object.defineProperty(exports, "parse", { enumerable: !0, get: function() { return _parsers.default } });

So any idea what might cause such a weird behaviour? Thanks in advance :)

cbarrerah avatar Jul 21 '23 14:07 cbarrerah