This project is a minimal working example of Pyodide and Webpack.
- Pyodide JavaScript package is installed from https://www.npmjs.com/package/pyodide
- Webpack and html page setup is from https://webpack.js.org/guides/getting-started/, two files are added and tweaked
src/index.js: contain the code for- dynamic import Pyodide JavaScript package.
loadPyodide: download Pyoddie files setup Pyodide environment.pyodide.runPython: show HTML DOM text added by Pyodide Python.
dist/index.html: use builtmain.js.
- Execute
npm installto install Pyodide JS package.- To fix npm pyodide 0.18.2 issue, you need to copy a fixed version of load-pyodide.js to
node_moduels/pyodide/load-pyodide.js, before a new version of Pyodide npm package is release.
- To fix npm pyodide 0.18.2 issue, you need to copy a fixed version of load-pyodide.js to
- Execute
npx webpackto generateddist/main.jsfromsrc/index.js. There is no webpack config file needed. - Use a browser to open
dist/index.html