Code Monkey home page Code Monkey logo

Comments (6)

pinussilvestrus avatar pinussilvestrus commented on August 13, 2024 1

Thanks for sharing, I will have a look 👍

from form-js-examples.

pinussilvestrus avatar pinussilvestrus commented on August 13, 2024

Hi @DK-2013 , thanks for reporting!

Can you maybe share the errors you got? We had problems with vite properly deduplicating preact, that's why we ended up using webpack in our example who handles it better: #7

from form-js-examples.

DK-2013 avatar DK-2013 commented on August 13, 2024

I make branch with sample in fork of this repo - directory: wrapper-sample.
steps in sample:

  1. npm i
  2. npm run dev
  3. drug Range field to form (http://localhost:5173/)

image

from form-js-examples.

pinussilvestrus avatar pinussilvestrus commented on August 13, 2024

When checking the project out, I get the same errors as when we experimented with vite during #6. Vite do not properly deduplicate preact leading to the known

TypeError: Cannot read properties of undefined (reading 'context').

This was the reason we moved to our standard webpack pattern. Would it be an option for you to try something else then vite?

In the meantime, we should figure out how to properly support vite here.

from form-js-examples.

DK-2013 avatar DK-2013 commented on August 13, 2024

I found this solution, but it is not applicable for libs using pattern, which implemented in properties-panel.
Current structure project is complex to change build tools (client app - wrapper lib - @bpmn-io lib), include integrate react based lib to preact.
Other side if will be impossible use vite then need impliment properties-panel or search other solution.

Anyway thank you for your carry!

from form-js-examples.

pinussilvestrus avatar pinussilvestrus commented on August 13, 2024

Update: I tried a couple of things in vite via resolve.alias and the @rollup/plugin-alias plugin to to the module replacement, without any luck so far.

The main problems remains that we bundle preact inside the properties panel, which vite can't properly replace although it's defined via config.

resolve: {
  alias: [
    {
      find: 'preact/hooks',
      replacement: path.resolve(__dirname, 'node_modules/preact/hooks/dist/hooks.module.js'),
    },
    {
      find: 'preact/jsx-runtime',
      replacement: path.resolve(__dirname, 'node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js'),
    },
    {
      find: 'preact/jsx-dev-runtime',
      replacement: path.resolve(__dirname, 'node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js'),
    },
    {
      find: 'preact/devtools',
      replacement: path.resolve(__dirname, 'node_modules/preact/devtools/dist/devtools.module.js'),
    },
    {
      find: 'preact/debug',
      replacement: path.resolve(__dirname, 'node_modules/preact/debug/dist/debug.module.js'),
    },
    {
      find: 'preact/compat',
      replacement: path.resolve(__dirname, 'node_modules/preact/compat/dist/compat.module.js'),
    },
    {
      find: 'preact',
      replacement: path.resolve(__dirname, 'node_modules/preact/dist/preact.module.js'),
    }
  ]
}

from form-js-examples.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.