Closed AsyncBanana closed 3 years ago
+1, it looks like it prevents me from doing some tests with Jest.
Just released v0.18.1 that should fix this.
Thanks a lot for your great reactivity! I upgraded the package to 0.18.1 (and checked the associated package.json file in my _nodemodules folder, the module type is here) but I still have the error when running tests with Jest (but it's running fine otherwise). I am not sure it comes from browser-fs-access.
But here's my trace if it can help in any way:
XXXXXanonymizationXXXXX\node_modules\browser-fs-access\dist\index.js:2
export{fileOpen}from"./file-open.mjs";export{directoryOpen}from"./directory-open.mjs";export{fileSave}from"./file-save.mjs";export{default as supported}from"./supported.mjs";
^^^^^^
SyntaxError: Unexpected token 'export'
1 | import { polygon, Properties } from '@turf/helpers';
2 | import { union } from '@turf/turf';
> 3 | import { directoryOpen, FileWithDirectoryHandle, supported as fsSupported } from 'browser-fs-access';
| ^
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
In #42, this was traced down to https://github.com/facebook/jest/issues/2550#issuecomment-810144368.
The index.js seems to be a CommonJS module to some build tools (notably Sveltekit's static adapter) because it does not have a .mjs suffix and there is no
"type": "module"
in the package.json. Two solutions are to add the module type to package.json, which would allow for the removal of all .mjs suffixes, or add an mjs suffix to index.js.