简体   繁体   English

如何在我的组件中导入 javascript min 文件?

[英]How can I import javascript min file in my component?

I'm working on the react project.我正在研究反应项目。 I created project with create-react-app.我用 create-react-app 创建了项目。 I need to import 'js-sequence-diagram' javascript file in my component.我需要在我的组件中导入“js-sequence-diagram”javascript 文件。 How can I import javascript min file in my component?如何在我的组件中导入 javascript min 文件?

what I want to do is: https://github.com/zfanta/react-sequence-diagram我想做的是: https : //github.com/zfanta/react-sequence-diagram

where "index.js" file "sequence-diagram-2.0.1.js" file was used.其中使用了“index.js”文件“sequence-diagram-2.0.1.js”文件。 But I could not use it like that.但我不能那样使用它。

1- install it first using 1-首先使用安装它

npm install react-sequence-diagram

2- then just put import SequenceDiagram from 'react-sequence-diagram; 2- 然后import SequenceDiagram from 'react-sequence-diagram; where ever you want to use the component您想在何处使用该组件

你能试试这个吗

import * as Diagram from './sequence-diagram-2.0.1'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM