-
-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Can't resolve 'react/jsx-runtime' #45
Comments
next.config.js const { withModuleFederation } = require("@module-federation/nextjs-mf");
const path = require("path");
module.exports = {
future: {
webpack5: true,
},
webpack: (config, options) => {
const name = "nextjs-webapp-template";
const mfConf = {
mergeRuntime: true,
name,
library: { type: config.output.libraryTarget, name },
filename: "static/runtime/remoteEntry.js",
remotes: {
// For SSR, resolve to disk path (or you can use code streaming if you have access)
[name]: options.isServer
? path.resolve(
__dirname,
`../${name}/.next/server/static/runtime/remoteEntry.js`
)
: name, // for client, treat it as a global
},
exposes: {
"./StaticAssets": "./src/modules/StaticAssets/index",
},
shared: [],
};
withModuleFederation(config, options, mfConf);
if (!options.isServer) {
config.output.publicPath = "http://localhost:3000/_next/";
}
// Important: return the modified config
return config;
},
}; _document.js import Document, { Html, Head, Main, NextScript } from "next/document";
import { patchSharing } from "@module-federation/nextjs-mf";
class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}
render() {
return (
<Html>
{patchSharing()}
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument; |
adding
seem to fix this issue. but now getting
|
looks related to ESM issues |
good, a combination of 0.3.0 and the resolve.alias fixed the build when i don't have anything under the @ScriptedAlchemy any idea of this error? seems to happen when i add something into the
|
ah, it was because i used |
I tried to add module federation to a brand new nextjs app and i'm seeing this error. Full Error
I checked node_modules and sees
react/jsx-runtime.js
in the directory. possibly related to this react issue. I can't seem to find regarding this fix.Archive.zip
i zipped up a sample code that shows the issue. just run
yarn build
oryarn dev
to see the error.Here are the versions we are using
Any ideas?
The text was updated successfully, but these errors were encountered: