Im trying to mount a React-App build and complied through webpack on a Lightning Web component. when i use loadScript to load the bundled Js file, I get "Failed to load script at /resource/1588059730000/solution_console_react/main.chunk.js: regeneratorRuntime is not defined [regeneratorRuntime is not defined]".
Component.js
import { loadStyle, loadScript } from "lightning/platformResourceLoader";
import scStyles from "@salesforce/resourceUrl/solution_console_react_styles";
import scReact from "@salesforce/resourceUrl/solution_console_react";
export default class reactStaticResourceLoader extends LightningElement {
connectedCallback() {
Promise.all([
loadStyle(this, scStyles + "/static/css/main.css"),
loadScript(this, scReact + "/runtime-main.js"),
loadScript(this, scReact + "/main.chunk.js"),
])
.then(() => {
console.log("scripts Loaded");
})
.catch((err) => {
console.log(err);
});
}
}
main.css - Is the styles file runtime-main.js - it is the runtime script to load and run the react app main.chunk.js - the react app bundled to a single file using the webpack.
I need some help in loading these scripts on a LWC so that I can run my React app.