Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an module dependencies conflicts? #13

Closed
Ken-Scofield opened this issue Apr 19, 2024 · 12 comments
Closed

Is there an module dependencies conflicts? #13

Ken-Scofield opened this issue Apr 19, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@Ken-Scofield
Copy link

Describe the Bug

When remove this config belew in webpack configs, I got an error. (custom components demo)

error screenshot:
666

webpack config:
// new NormalModuleReplacementPlugin(
// /^(../preact|preact)(/[^/]+)?$/,
// function (resource) {
// const replMap = {
// 'preact/hooks': path.resolve('node_modules/preact/hooks/dist/hooks.module.js'),
// 'preact/jsx-runtime': path.resolve('node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js'),
// preact: path.resolve('node_modules/preact/dist/preact.module.js'),
// '../preact/hooks': path.resolve('node_modules/preact/hooks/dist/hooks.module.js'),
// '../preact/jsx-runtime': path.resolve('node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js'),
// '../preact': path.resolve('node_modules/preact/dist/preact.module.js')
// }
// const replacement = replMap[resource.request]
// console.log('resource-request', resource.request)
// if (!replacement) {
// return
// }
// resource.request = replacement
// }
// )
Can you help me, find it out this problems? @pinussilvestrus ,thanks

Environment

  • Host (Browser/Node version), if applicable: [e.g. MS Edge 18, Chrome 69, Node 10 LTS]
  • OS: [e.g. Windows 7]
  • Library version: [e.g. 2.0.0]
@Ken-Scofield Ken-Scofield added the bug Something isn't working label Apr 19, 2024
@Ken-Scofield
Copy link
Author

it's seems somewhere read hooks.module.js in error place, i cant figure it out? help!

@Ken-Scofield
Copy link
Author

Ken-Scofield commented Apr 19, 2024

And, if i add this webpack config, I got another error in bpmnjs : EventBus.js:421 unhandled error in event listener TypeError: Cannot read properties of null (reading '__H') , help help help... bpmnjs report.

@Ken-Scofield
Copy link
Author

@nikku can you help me? Is this because of the dependency "preact" ?

@nikku
Copy link
Member

nikku commented Apr 22, 2024

Ensure you de-duplicate preact. Which example can you reproduce this with?

@Ken-Scofield
Copy link
Author

Ken-Scofield commented Apr 22, 2024

Ensure you de-duplicate preact. Which example can you reproduce this with?

https://github.com/Ken-Scofield/bpmn-form-demo.git,my demo address, please carry me.

@Ken-Scofield
Copy link
Author

Ken-Scofield commented Apr 22, 2024

Running with webpack5. Can't use "playground" and something else at the same time, OR, how to de-duplicate preact in webpack5?

@Ken-Scofield
Copy link
Author

And i try :
resolve: {
alias: {
preact: path.resolve(__dirname, 'node_modules/preact'),
'../preact': path.resolve(__dirname, 'node_modules/preact')
// 'preact/hooks': path.resolve(__dirname, 'node_modules/preact/hooks/dist/hooks.module.js'),
// 'preact/jsx-runtime': path.resolve(__dirname, 'node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js'),
// 'preact/compat': path.resolve(__dirname, 'node_modules/preact/compat/dist/compat.module.js')
}
},
then bpmnjs not worked?
999

@Ken-Scofield
Copy link
Author

I have used form-js-example and bpmn-js example in one project, and they cant work in the same time cause of preact module . Please help me firgure it out, Thanks ! @nikku

@Ken-Scofield
Copy link
Author

@Skaiir

@Ken-Scofield
Copy link
Author

Ken-Scofield commented Apr 24, 2024

finnally, i figure it out , cause preact duplicate, see https://github.com/Ken-Scofield/bpmn-form-demo,

resolve: {
      alias: {
        preact: path.resolve(__dirname, 'node_modules/preact'),
        '@bpmn-io/properties-panel/preact': path.resolve(__dirname, 'node_modules/preact'),
        '../preact': path.resolve(__dirname, 'node_modules/preact')
      }
},

3 path are used to import preact , set 3 alias to resolve it, I don't know if it's correct, but it does solve the problem.

@nikku
Copy link
Member

nikku commented Apr 24, 2024

@Ken-Scofield Beyond aliasing (which always works) npm dedupe or explicit dependency versioning through
overrides are known to work techniques to address this issue.

@nikku nikku closed this as completed Apr 24, 2024
@Ken-Scofield
Copy link
Author

@Ken-Scofield Beyond aliasing (which always works) npm dedupe or explicit dependency versioning through overrides are known to work techniques to address this issue.

Thank you very much, I've learned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants