Skip to content

ES Module - SvelteKit project #11

@CaffeinatedTech

Description

@CaffeinatedTech

Hey there,

I'm implementing your 3d dice module into a static SvelteKit project, and have hit the following error adding the DisplayResults module.

(node:5057) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
08:36:11 [vite] Error when evaluating SSR module /src/routes/game/+page.svelte: failed to import "@3d-dice/dice-ui"
|- /home/adam/projects/dice-party/node_modules/.pnpm/@[email protected]/node_modules/@3d-dice/dice-ui/src/index.js:1
export { default as DisplayResults } from './displayResults'
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1153:20)
    at Module._compile (node:internal/modules/cjs/loader:1197:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:165:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
    at async nodeImport (file:///home/adam/projects/dice-party/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:56019:17)

I tried a dirty fix of just adding "type": "module", to the package.json, but that brought about some other errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions