Skip to content
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

Problem with code splitted components #64

Open
smeng9 opened this issue Mar 31, 2023 · 1 comment
Open

Problem with code splitted components #64

smeng9 opened this issue Mar 31, 2023 · 1 comment

Comments

@smeng9
Copy link

smeng9 commented Mar 31, 2023

Hi @joelnet

I currently have a remote component in cjs format that is splitted into two files rather than a single file.
The remote component internally uses lazy and Suspense.

When I tried to use the remote component, it will not be able to resolve the file in the splitted chunk.

I have provided a snippet of the compiled output of that remote component.

"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./5a3484eb-chunk.cjs");require("react");require("react-dom");require("react-hook-form");exports.default=e.RemoteComponent;

The problem is the require("./5a3484eb-chunk.cjs") trying to resolve to a relative file chunk and https://github.com/Paciolan/remote-component/blob/master/src/createRequires.ts does not have the require.

I would like to know if that would be possible to use the remote component with react component that contains splitted chunk? Thanks!

@joelnet
Copy link
Member

joelnet commented Mar 31, 2023

Currently split bundles are not supported. All code must be contained within a single js file for the module loader to load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants