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

create-react-app fails to bundle properties panel - minDash.isArray is not a function #1058

Closed
BehzadBakhshayesh opened this issue Jun 18, 2024 · 7 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@BehzadBakhshayesh
Copy link

BehzadBakhshayesh commented Jun 18, 2024

Bug Description

Hello. I created a React component using the "bpmn-js", "@bpmn-io/properties-panel", and "bpmn-js-properties-panel" packages. An error emerges when utilizing the CamundaPlatformPropertiesProviderModule, displaying: TypeError: minDash.isArray is not a function. It seems that this issue stems from the min-dash version, and updating it should resolve the error.

"dependencies": {
  "@bpmn-io/properties-panel": "^3.21.0",
  "bpmn-js": "^17.8.2",
  "bpmn-js-properties-panel": "^5.17.1",
  "min-dash": "^4.2.1",
  "react": "^18.3.1",
  "react-dom": "^18.3.1"
},

Reproduction Steps

I'm using the following code and try to bundle the application using create-react-app:

import BpmnModeler from "bpmn-js/lib/Modeler";
import {
  BpmnPropertiesPanelModule,
  BpmnPropertiesProviderModule,
  CamundaPlatformPropertiesProviderModule
} from "bpmn-js-properties-panel";
import "bpmn-js/dist/assets/diagram-js.css";
import "bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css";
import "@bpmn-io/properties-panel/assets/properties-panel.css";
bpmnModeler.current = new BpmnModeler({
  container: canvasRef.current,
  propertiesPanel: {
    parent: propertiesPanelRef.current
  },
  additionalModules: [
    BpmnPropertiesPanelModule,
    BpmnPropertiesProviderModule,
    CamundaPlatformPropertiesProviderModule
  ]
});

Then reload the application.

Expected Outcome

Kindly address this issue.

Environment

  • Host: Browser
  • Browser: Google Chrome v125
  • OS: Windows 10
  • Library Version: 2.0.0
@BehzadBakhshayesh BehzadBakhshayesh added the bug Something isn't working label Jun 18, 2024
@barmac
Copy link
Member

barmac commented Jun 18, 2024

This looks more like a bundler issue. Can you reproduce this problem in a codesandbox?

@barmac barmac added the needs more information Requires additional information to be actionable. label Jun 18, 2024
@BehzadBakhshayesh
Copy link
Author

BehzadBakhshayesh commented Jun 18, 2024

Error doesn't appear on codesandbox but is present in my setup. Could you please review my repository?
(both codes are identical...)

@nikku
Copy link
Member

nikku commented Jun 18, 2024

@BehzadBakhshayesh Please ensure you also recognize JavaScript files with a mjs or cjs extension; otherwise you'll force your bundler to use incompatible files in an ESM or legacy setup.

To test if things work, try to simplify your setup to just use min-dash.

@nikku nikku closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2024
@nikku nikku reopened this Jun 18, 2024
@nikku
Copy link
Member

nikku commented Jun 18, 2024

As you're using just plain create-react-app this should work out of the box.

@nikku nikku changed the title min-dash error in CamundaPlatformPropertiesProviderModule create-react-app fails to bundle properties panel - minDash.isArray is not a function Jun 18, 2024
@barmac
Copy link
Member

barmac commented Jun 18, 2024

I run your code locally, and the error is thrown from the @bpmn-io/extract-process-variables module. For a reason still unknown to me, the require var minDash = require('min-dash'); is resolved as a path to a file:
image

@barmac barmac self-assigned this Jun 18, 2024
@nikku
Copy link
Member

nikku commented Jun 19, 2024

@barmac cjs is not properly recognized as a JS asset, hence the static resolution to a file, cf. #1058 (comment).

I believe this is tracked upstream via facebook/create-react-app#12700.

@BehzadBakhshayesh There is nothing we can do to remedy this. create-react-app simply has to fix things

@nikku nikku closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
@nikku nikku added wontfix This will not be worked on and removed needs more information Requires additional information to be actionable. labels Jun 19, 2024
@BehzadBakhshayesh
Copy link
Author

@nikku @barmac Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Development

No branches or pull requests

3 participants