2

I am creating a pluggable widget in React, to be used in a Mendix application, that makes use of the ketcher-react package.

With just the basics in place (see code below), when I want to build using npm run build, I get the following error:

Error: 'url' is imported by url?commonjs-external, but could not be resolved – treating it as an external dependency

FYI: url?commonjs-external is used in the index.js file of @rollup\plugin-commonjs

Hope someone can help me out!

Here is my functional component (nothing special, just the configuration suggested by ketcher):

import { ReactElement, createElement } from "react";
import { StandaloneStructServiceProvider } from 'ketcher-standalone';
import { Editor } from "ketcher-react";

import { KetcherMolecularEditorContainerProps } from "../typings/KetcherMolecularEditorProps";

import "./ui/KetcherMolecularEditor.css";


const structServiceProvider = new StandaloneStructServiceProvider();

export function KetcherMolecularEditor({ sampleText }: KetcherMolecularEditorContainerProps): ReactElement {
    console.log(sampleText);
    return (
        <Editor
            staticResourcesUrl={process.env.PUBLIC_URL || ""}
            structServiceProvider={structServiceProvider} 
            errorHandler={(message: String): void => { console.error(message)}}        
        />
      )
}
1
  • 1
    same problem, may I ask how did you end up solving this? Commented Apr 12, 2023 at 1:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.