Skip to content

Error when building wikijs with Vite: Cannot acces stream.Transfrom in client code #175

Description

@powerslave

I am running into a browser error when trying to execute the basic wikijs sample snippet:
The project builds with Vite 3.2.3.

Is there a build option needed for Vite, similar to Usage with Webpacl?

Browser error:

stream-tokenizer.js:5 Uncaught TypeError: Class extends value undefined is not a constructor or null
    at node_modules/hyntax/lib/stream-tokenizer.js (stream-tokenizer.js:5:1)
    at __require (chunk-TWLJ45QX.js?v=8133fa8e:8:50)
    at node_modules/hyntax/index.js (index.js:3:25)
    at __require (chunk-TWLJ45QX.js?v=8133fa8e:8:50)
    at page.js:2:41

There is also a (related?) warning above this error.
browser-external:stream:9 Module "stream" has been externalized for browser compatibility. Cannot access "stream.Transform" in client code.

code:

import wiki from "wikijs";

    wiki()
      .page("Batman")
      .then((page) => page.info("alterEgo"))
      .then(console.log); // Bruce Wayne

package.json config

"wikijs": "^6.4.1"
"vite": "^3.2.3"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions