-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hello,
I tried to use this plugin with Next but I get this error
> next dev
▲ Next.js 15.5.3
- Local: http://localhost:3000
- Network: http://192.168.1.181:3000
- Environments: .env.local
✓ Starting...
TypeError: The 'compilation' argument must be an instance of Compilation
at <unknown> (webpack://pyodide/webpack-plugin/index.ts:50:58)
48 | super.apply(compiler);
49 | compiler.hooks.compilation.tap(this.constructor.name, (compilation) => {
> 50 | const compilationHooks = webpack.NormalModule.getCompilationHooks(compilation);
| ^
51 | compilationHooks.beforeLoaders.tap(this.constructor.name, (loaders, normalModule) => {
52 | const matches = normalModule.userRequest.match(/pyodide\.m?js$/);
53 | if (matches) {
Here is my next.config.mjs
:
/** @type {import('next').NextConfig} */
import { PyodidePlugin } from "@pyodide/webpack-plugin";
const nextConfig = {
output: "export", // Outputs a Single-Page Application (SPA).
distDir: "./dist", // Changes the build output directory to `./dist/`.
webpack: (config) => {
config.plugins.push(new PyodidePlugin());
return config;
},
};
export default nextConfig;
And the usage :
import { loadPyodide, version } from "pyodide";
const pyodideReadyPromise = loadPyodide({
indexURL: `${window.location.origin}/pyodide`,
});
I also tried with globalLoadPyodide
but can't manage to make it work...
Any ideas ?
Metadata
Metadata
Assignees
Labels
No labels