NativeScript/angular

Katex in a nativescript-angular project does not seem to have a default export

bnlambert opened this issue · 3 comments

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI:
  • Cross-platform modules: "@angular/compiler-cli": "~18.0.0",
  • Android Runtime: "@nativescript/android": "8.8.1-next.2024-07-19-10014251437",
  • iOS Runtime:
  • Plugin(s): "katex": "^0.16.11",, "@types/katex": "^0.16.7",
  • NativeScript-Angular: "@nativescript/angular": "^18.0.0",
  • Angular: "@angular/core": "~18.0.0",

Describe the bug

After the installation of katex in the nativescript-angular project, I keep getting the Module ... had no default export error as seen in the screenshot below.

katex

How could be done to have resolve this error?

NB: Katex works well in my angular projects

To Reproduce

Expected behavior

Sample project

Additional context

you can try import * as katex from 'katex' instead.

Thank you @edusperoni for your response.

When I implement your suggestion, the Module ... no default export disappears but when I visit the page using katex, the app crashes with the error

ERROR TypeError: katex__WEBPACK_IMPORTED_MODULE_0__.renderToString is not a function

katex-weback

I managed to solve the issue by adding the property "allowSyntheticDefaultImports": true, to the compileOptions object in the tsconfig.json file.