Skip to content

Commit

Permalink
#2411 - Replace commonJS with dynamic ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleicul committed Apr 18, 2023
1 parent 68d2696 commit ad5577a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ let structServiceProvider: StructServiceProvider =
process.env.API_PATH || process.env.REACT_APP_API_PATH!
)
if (process.env.MODE === 'standalone') {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { StandaloneStructServiceProvider } = require('ketcher-standalone')
structServiceProvider =
new StandaloneStructServiceProvider() as StructServiceProvider
const { StandaloneStructServiceProvider } = await import('ketcher-standalone')
structServiceProvider = new StandaloneStructServiceProvider()
}

const enablePolymerEditor = process.env.ENABLE_POLYMER_EDITOR === 'true'
Expand All @@ -40,8 +38,7 @@ type PolymerType = () => JSX.Element | null

let PolymerEditor: PolymerType = () => null
if (enablePolymerEditor) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { Editor } = require('ketcher-polymer-editor-react')
const { Editor } = await import('ketcher-polymer-editor-react')
PolymerEditor = Editor as PolymerType
}

Expand Down
2 changes: 1 addition & 1 deletion example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"target": "es5",
"target": "esnext",
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand Down

0 comments on commit ad5577a

Please sign in to comment.