Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Named export 'SourceMap' not found. #1695

Closed
tzmara opened this issue Jun 22, 2024 · 6 comments · Fixed by volarjs/volar.js#210 or twoslashes/twoslash#44
Closed

SyntaxError: Named export 'SourceMap' not found. #1695

tzmara opened this issue Jun 22, 2024 · 6 comments · Fixed by volarjs/volar.js#210 or twoslashes/twoslash#44
Labels
bug:upstream bug Something isn't working has workaround help wanted Extra attention is needed

Comments

@tzmara
Copy link

tzmara commented Jun 22, 2024

Describe the bug
Installing doesn't work anymore: Tried with npm, pnpm, node version 22.3.0 and 20.15.0.

The error:

❯ pnpm run dev

> slidev@ dev /tmp/slidev
> slidev --open

file:///tmp/slidev/node_modules/.pnpm/twoslash-vue@0.2.8_typescript@5.5.2/node_modules/twoslash-vue/dist/index.mjs:1
import { SourceMap, createVueLanguagePlugin, resolveVueCompilerOptions, createLanguage, FileMap } from '@vue/language-core';
         ^^^^^^^^^
SyntaxError: Named export 'SourceMap' not found. The requested module '@vue/language-core' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@vue/language-core';
const { SourceMap, createVueLanguagePlugin, resolveVueCompilerOptions, createLanguage, FileMap } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async Promise.all (index 3)
    at async createMarkdownItShiki (file:///tmp/slidev/node_modules/.pnpm/@slidev+cli@0.49.11_@babel+parser@7.24.7_@nuxt+kit@3.12.2_rollup@4.18.0__@types+markdown-it@1_6tnekf4fwgz6aia3gk7z6ugwwu/node_modules/@slidev/cli/dist/chunk-4LA667A3.mjs:9295:7)
    at async createMarkdownPlugin (file:///tmp/slidev/node_modules/.pnpm/@slidev+cli@0.49.11_@babel+parser@7.24.7_@nuxt+kit@3.12.2_rollup@4.18.0__@types+markdown-it@1_6tnekf4fwgz6aia3gk7z6ugwwu/node_modules/@slidev/cli/dist/chunk-4LA667A3.mjs:9237:20)
    at async Promise.all (index 0)
    at async ViteSlidevPlugin (file:///tmp/slidev/node_modules/.pnpm/@slidev+cli@0.49.11_@babel+parser@7.24.7_@nuxt+kit@3.12.2_rollup@4.18.0__@types+markdown-it@1_6tnekf4fwgz6aia3gk7z6ugwwu/node_modules/@slidev/cli/dist/chunk-4LA667A3.mjs:9603:11)
    at async resolveViteConfigs (file:///tmp/slidev/node_modules/.pnpm/@slidev+cli@0.49.11_@babel+parser@7.24.7_@nuxt+kit@3.12.2_rollup@4.18.0__@types+markdown-it@1_6tnekf4fwgz6aia3gk7z6ugwwu/node_modules/@slidev/cli/dist/chunk-4LA667A3.mjs:9671:7)
    at async createServer (file:///tmp/slidev/node_modules/.pnpm/@slidev+cli@0.49.11_@babel+parser@7.24.7_@nuxt+kit@3.12.2_rollup@4.18.0__@types+markdown-it@1_6tnekf4fwgz6aia3gk7z6ugwwu/node_modules/@slidev/cli/dist/chunk-G75DCGK3.mjs:11:24)

Node.js v20.15.0
 ELIFECYCLE  Command failed with exit code 1.

To Reproduce
Steps to reproduce the behavior:

  1. pnpm create slidev (or npm init slidev@latest
  2. the error appears after node_module got populated

What I tried

  • Reinstall
  • Cache Delete
  • NPM and PNPM
  • Asking on discord

Desktop (please complete the following information):

  • OS: Arch Linux (6.9.5 Kernel)
  • Browser: Chrome
  • Slidev version: "0.49.11"
@KermanX KermanX added bug Something isn't working bug:upstream labels Jun 22, 2024
@lng205
Copy link

lng205 commented Jun 22, 2024

Same Problem

@KermanX KermanX added the help wanted Extra attention is needed label Jun 22, 2024
@KermanX
Copy link
Member

KermanX commented Jun 22, 2024

Appending the following to your package.json can solve this. Sorry for the inconvenience.

  "resolutions": {
    "twoslash-vue": "0.2.7"
  }

I think the problem is caused by twoslashes/twoslash#40.

@zhiyuanzmj
Copy link

Because of today published volar2.3.1 removed SourceMap.
I will locked the volar version.

https://github.com/volarjs/volar.js/pull/207/files#diff-9b91681a6cad2a7185ae1fa36e153880167c7081a2a664a52c279e3c7f89a52eL1

@johnsoncodehk
Copy link
Contributor

Sorry for the confusion, updating @vue/language-core to 2.0.22 should resolve this issue.

@KermanX
Copy link
Member

KermanX commented Jun 22, 2024

Sorry for the confusion, updating @vue/language-core to 2.0.22 should resolve this issue.

@vue/language-core@2.0.22 seems still doesn't work:

image


Since volarjs/volar.js#210 has been merged, we can close this issue now.

@johnsoncodehk
Copy link
Contributor

Please track for twoslashes/twoslash#44.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:upstream bug Something isn't working has workaround help wanted Extra attention is needed
Projects
None yet
5 participants