Integrate @elsa-workflows/elsa-workflows-studio into React App #4372
JinHe-PerkinElmer
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Amazing, thank you for sharing this much-asked for information @JinHe-PerkinElmer ! 🙌🏻 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Record the process of integrating Elsa V2 into React APP.
index.jsx
.import { defineCustomElements, applyPolyfills } from '@elsa-workflows/elsa-workflows-studio/loader';
import 'monaco-editor/min/vs/loader';
import '@elsa-workflows/elsa-workflows-studio/dist/elsa-workflows-studio/elsa-workflows-studio.css';
applyPolyfills().then(() => { defineCustomElements(window); });
Because @elsa-workflows/elsa-workflows-studio built with stenciljs. Need to do some transformations in react. https://stenciljs.com/docs/react
{ test: /\.(js|mjs)$/, exclude: /@babel(?:\/|\\{1,2})runtime/, loader: require.resolve('babel-loader'), options: { babelrc: false, configFile: false, compact: false, presets: [ [ require.resolve('babel-preset-react-app/dependencies'), { helpers: true }, ], { plugins: [ '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-optional-chaining', ], }, ], cacheDirectory: true, cacheCompression: isEnvProduction, sourceMaps: false, }, },
<elsa-studio-root serverUrl="Your_Server_Url" monacoLibPath="your_monacoLibPath"> <elsa-studio-dashboard /> </elsa-studio-root>
In this way, Elsa can be used in the react app. But there are still some problems: Unfortunately, Elsa studio does not use css module. the imported css of Elsa will affect the style of antd input/dropdown, which needs to be processed manually.
Of course, if you want to see the effect, you need to start the service in the background, or start the service yourself locally.
Beta Was this translation helpful? Give feedback.
All reactions