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)}}        
        />
      )
}
MWB
  • 1,830
  • 1
  • 17
  • 38

0 Answers0