question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to compile pyodide using webpack and typescript

See original GitHub issue

🐛 Bug

When I’m trying to use pyodide in typescript project I’m getting bunch of errors during compilation:

  • error-stack-parser does not export StackFrame from ErrorStackParser in version 2.0.7 which is currently installed with pyodide. It has been fixed in 2.1.0 so I’m assuming that updating version will fix this issue.
ERROR in ../../node_modules/pyodide/error_handling.gen.ts 193:49-59
TS2694: Namespace 'ErrorStackParser' has no exported member 'StackFrame'.
    191 | Tests.convertCppException = convertCppException;
    192 |
    193 | function isPyodideFrame(frame: ErrorStackParser.StackFrame): boolean {
        |                                                 ^^^^^^^^^^
    194 |   const fileName = frame.fileName || "";
    195 |   if (fileName.includes("pyodide.asm")) {
    196 |     return true;
  • if it comes to three below errors I’m not sure what is the reason
ERROR in ../../node_modules/pyodide/api.ts 13:21
Module parse failed: Unexpected token (13:21)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  * from JavaScript.
|  */
> export let pyodide_py: PyProxy; // actually defined in loadPyodide (see pyodide.js)
| 
| /**
ERROR in ../../node_modules/pyodide/load-package.ts 6:11
Module parse failed: Unexpected token (6:11)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
| /** @private */
> let baseURL: string;
| /**
|  * Initialize the packages index. This is called as early as possible in
ERROR in ../../node_modules/pyodide/pyodide.ts 29:7
Module parse failed: Unexpected token (29:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| } from "./pyproxy.gen";
| 
> export type Py2JsResult = any;
| 
| let runPythonInternal_dict: PyProxy; // Initialized in finalizeBootstrap

To Reproduce

Please use following repository. Errors related to ErrorStackParser are not showing using this project (I installed newer version) however is still should be fixed.

Expected behavior

Pyodide package is compiling.

Environment

  • Pyodide Version: 0.20.0
  • Browser version: N/A
  • Any other relevant information:

Additional context

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
hoodmanecommented, Jul 6, 2022

It’s been an ongoing issue for us that we don’t have any developers with much JavaScript/webpack expertise.

0reactions
hoodmanecommented, Aug 28, 2022

Huh I don’t know which commit would have fixed this but that’s good news. Maybe we can reenable the webpack test

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to compile and publish my Typescript library using ...
So first i need to compile my src directory to a single javascript file and i have 2 ways to do so, using...
Read more >
Release 0.21.3 unknown - Pyodide
Pyodide is a port of CPython to WebAssembly/Emscripten. Pyodide makes it possible to install and run Python packages in the browser with ......
Read more >
Generate WebAssembly With AssemblyScript: a TypeScript ...
Learn how to write WebAssembly code with the familiarity of a TypeScript-like language, create low-level code with the existing web ...
Read more >
I want to believe so bad. Being able to do web development with ...
People are using a variety languages that compile to JS on the frontend for many years. Elm, TypeScript, ClojureScript, Reason, Scala.js, Fable, etc....
Read more >
Bringing Esbonio to the Browser — Blog documentation
This proves that it's possible to run Python code via Pyodide from ... was written in TypeScript which needs to be compiled into...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found