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.

create webpack plugin

See original GitHub issue

webpack plugin

I would appreciate it if someone else could help with this though. I’ve tried to write a webpack plugin several times but always run into the problem that I was unable to use webpack with Pyodide at all. Perhaps with @mneil’s example I would have an easier time, but the webpack plugin API is also very confusing. If it’s just a wrapper around CopyPlugin then that probably isn’t too hard.

In @mneil’s example, he also patches pyodide.js to remove the global assignment to loadPyodide, but if you use pyodide.mjs instead of pyodide.js it doesn’t assign loadPyodide to the global scope. We make pyodide.js out of pyodide.umd.ts which just adds the globalThis assignment to pyodide.ts: https://github.com/pyodide/pyodide/blob/main/src/js/pyodide.umd.ts Whereas pyodide.mjs is made from pyodide.ts directly. Though deleting that line is also an option if using webpack to load a module is not possible.

_Originally posted by @hoodmane in https://github.com/pyodide/pyodide/issues/3085#issuecomment-1241155294_

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
rthcommented, Sep 24, 2022

OK, moved it to https://github.com/pyodide/pyodide-webpack-plugin. It would be nice to switch to this plugin in https://github.com/pyodide/pyodide-webpack-example. You also have write permissions there, but it would still be good to make changes via PRs for that example repo.

I’m closing this issue as resolved, thanks @mneil! For follow-up discussions, it would probably be better to open separate issues in https://github.com/pyodide/pyodide-webpack-plugin. I’ll see if Pyodide repo has any relevant issues for webpack and if so transfer them there 😃

@dlech thanks for starting this discussion. If you would like to collaborate on that plugin or test and provide feedback that would also be very welcome.

1reaction
rthcommented, Sep 22, 2022

If you feel like you would be interested in maintaining it in the future I would be +1 for accepting it within the Pyodide org with you as its maintainer (if you are interested).

No matter where it would end up you should be able to do the release independently, I think. About npm release the only thing I’m not sure about is whether it would be better to publish it as pyodide-webpack or @pyodide/pyodide-webpack or some other variation (e.g. @pyodide/webpack). Not really sure about best practices with npm scopes.

WDYT @hoodmane @ryanking13 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing a Plugin - webpack
Creating a Plugin · A named JavaScript function or a JavaScript class. · Defines apply method in its prototype. · Specifies an event...
Read more >
Creating a Custom webpack Plugin - DigitalOcean
Create your own simple webpack plugin. We'll see how webpack's architecture is implemented and how plugins work under the hood.
Read more >
Building your own Webpack Plugin - DEV Community ‍ ‍
Create a project named my-first-webpack-plugin and install webpack in it. · Create a file my-first-webpack-plugin. · You can include this plugin ...
Read more >
Getting started with webpack - Part 8: Writing your own plugins
In this part, we will consider how to create your own webpack plugins from scratch. Chances are, you may never have to do...
Read more >
Learn Creating a Webpack Plugin - Frontend Masters
Sean demonstrates how to develop a custom plugin for Webpack. ... The "Creating a Webpack Plugin" Lesson is part of the full, Webpack...
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