Issue with npm start - Unexpected token
Hi,
I have included this in my project's package.json and did an npm install. Everything went fine, but when i do an npm start, i get the following issue:
Module parse failed: <project-location>\project-react\node_modules\storm-react-diagrams\src\defaults\DefaultLinkFactory.ts Unexpected token (14:34)
You may need an appropriate loader to handle this file type.
| }
|
| generateReactWidget(diagramEngine: DiagramEngine, link: LinkModel): JSX.Element {
| return React.createElement(DefaultLinkWidget, {
| link: link,
What do you think might be the issue ?
It seems that you don't use TypeScript in your project.
In that case proper way to include entities is through the package main like this
import {
DiagramEngine,
DefaultNodeFactory,
DefaultLinkFactory,
DiagramModel,
DefaultNodeModel,
LinkModel,
DefaultPortModel,
DiagramWidget,
PointModel
} from "storm-react-diagrams";
Note: Copy wisely, pick only classes that you need
Just a clarification, i do use Typescript though.
@tushartk ok, have you tried posted example? It is still correct way to do thing you want.
The reason your import doesn't work for you - most possibly webpack misconfiguration which prevents typescript loader to be used on node_modules. And it is OK because I believe it's not easy way to use this library
The posted example does work. Although even i guessed it might be an issue with the Typescript loaders when importing it in a project. Thanks anyway @JokerNN