fancyapps / ui

A library of JavaScript UI components, includes the best lightbox - Fancybox5
https://fancyapps.com/
Other
722 stars 91 forks source link

Unexpected token 'export' #620

Closed pokatow closed 3 months ago

pokatow commented 4 months ago

Describe the bug

Im using Svelte + Typescript and trying to import Pins plugin but get unexpected token 'export'.

Nb: I have set "allowJs": true on my tsconfig.json file

Reproduction

Code:

import { onMount } from 'svelte'
import { Pins } from '@fancyapps/ui/dist/panzoom/panzoom.pins.esm.js'
onMount(() => {
    new Panzoom(mapContainer, options, {Pins})
}

Run: npm run dev

Terminal:

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1176:20)
    at Module._compile (node:internal/modules/cjs/loader:1218:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Additional context

No response

fancyapps commented 4 months ago

Hi,

Sorry, but there is something to do with your setup, because you are trying to load ES6 module file as CJS.