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

Vitepress build error #2817

Closed
4 tasks done
soulaimaneyahya opened this issue Aug 18, 2023 · 8 comments
Closed
4 tasks done

Vitepress build error #2817

soulaimaneyahya opened this issue Aug 18, 2023 · 8 comments
Labels
need more info Further information is requested

Comments

@soulaimaneyahya
Copy link

Describe the bug

Execute command npm run docs:build and throw an exception: build error:
TypeError: Intl.Segmenter is not a constructor

Reproduction

.vitepress config.ts

import { defineConfig } from 'vitepress'

export default defineConfig({
  lang: 'en-US',
  lastUpdated: true,
  cleanUrls: true,

  themeConfig: {

    nav: nav(),

    sidebar: {
      '/rest-api/': sidebarRestApi(),
    }
  }
})

package.json

"scripts": {
    "dev:docs": "npx vitepress dev docs",
    "build:docs": "npx vitepress build docs",
    "serve:docs": "npx vitepress serve docs"
  },
  "dependencies": {
    "vue": "^3.3.4"
  },
  "devDependencies": {
    "vitepress": "^1.0.0-rc.4"
  }

Expected behavior

npm run build:docs

System Info

npx vitepress build docs

vitepress v1.0.0-rc.4

build error:
TypeError: Intl.Segmenter is not a constructor

Additional context

No response

Validations

@soulaimaneyahya soulaimaneyahya added the bug: pending triage Maybe a bug, waiting for confirmation label Aug 18, 2023
@brc-dd
Copy link
Member

brc-dd commented Aug 18, 2023

Please provide a minimal "complete" verifiable example, preferably using https://vitepress.new

The information you've provided is not sufficient enough to reproduce the issue at our end. Although, most likely seems to be an issue with your node version.

@brc-dd brc-dd added need more info Further information is requested and removed bug: pending triage Maybe a bug, waiting for confirmation labels Aug 18, 2023
@soulaimaneyahya
Copy link
Author

the same issue;

https://stackblitz.com/edit/vite-p57qkk?file=package.json

Works for dev but not for build

@brc-dd
Copy link
Member

brc-dd commented Aug 18, 2023

seems to build fine:

image

@soulaimaneyahya
Copy link
Author

build issue

Screenshot from 2023-08-18 23-16-36

@brc-dd
Copy link
Member

brc-dd commented Aug 19, 2023

Which browser are you on? StackBlitz doesn't work properly in firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1423593).

@brc-dd brc-dd closed this as completed in 877f643 Aug 19, 2023
@soulaimaneyahya
Copy link
Author

latest vitpress v support node-v > 16.2.0

@brc-dd
Copy link
Member

brc-dd commented Aug 19, 2023

The recommended version is node 18 or higher. It might however work on node 16 as well. But webcontainers (stackblitz) polyfill most of the code but not the Intl.Segmenter API which is available in node 16+ but is not there in firefox. It wasn't being used anywhere in the client code, but since technically node in webcontainers is running in the browser itself, so it was being executed. I have now downgraded that dependency in 877f643. It should work fine on firefox webcontainers from next release. Locally, rc-4 should also work fine.

@soulaimaneyahya
Copy link
Author

Thank you for the update! It's great to hear that the compatibility issue with Firefox and Node.js versions has been addressed by downgrading the dependency. I really appreciate your quick response and effort in making sure Vitepress works smoothly across different environments. Looking forward to the next release! 👍

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants