Open ojcchar opened 3 years ago
Hi Fredrik,
Great framework. It's been quite useful for us.
This is just a question. Not an issue.
We needed to modify the framework to meet our needs. I am wondering how do you build and test your framework in your machine? Disclaimer: we are not experts in npm, yarn, react, etc.
So, if I have an application (as a different project) that uses the framework, how do I build it and use it in my application, as opposed to using the npm package from the web?
So far, we have just copied the generated input.js into the node_modules directory. This seems like a dirty hack.
Any advice would be greatly appreciated.
Thank you.
Hi Oscar,
There's a few ways you could do this actually. The first way is to copy the source files directly form this project and include them in your own and then build them as a part of your own build pipeline.
The second way, and the one I would recommend is to fork this project, make the adjustments you need and then change the name in package.json and publish it to NPM under a different package name. Then you can include that package in your project.
For local development, you can use npm link in order to point your project to a local version of your package.
Thank you for your response, Fredrik.
I tried the third option with yarn.
However, I am running into an issue even if I use react-chatbot-kit unmodified (without my adjustments).
This is what I am doing:
yarn install
(I believe I should build it this way)yarn link
yarn link react-chatbot-kit
yarn start
)Note that if use the react-chatbot-kit published on npm, my application runs with no problem.
The problem only happens if I build react-chatbot-kit locally. BTW, I am running Windows, and this is what I get from building this package:
Maybe I am doing something wrong here. Any help would be appreciated.
FYI, this is the stack trace I am getting in the browser:
Thank you very much.
BTW, I tried removing yarn.lock, package-lock.json, node_modules, and build and I rebuilt the kit, but, I am having the same problem with my app.
BTW, I tried removing yarn.lock, package-lock.json, node_modules, and build and I rebuilt the kit, but, I am having the same problem with my app.
In your local version, try running yarn build and make sure you have a dist folder after that.
hmmm I ran yarn build
but no dist folder is created.
hmmm I ran
yarn build
but no dist folder is created.
Looks correct. It should be a build folder, not dist, apologies. Do you have your project on github? I need to take a closer look to figure out what's going on. I just did a test on my machine running yarn link with a fresh create-react-app project without any issues.
This is the project.
It uses the modified version of the framework and some local API calls, but the chatbot at least should be shown in the browser.
This is the project.
It uses the modified version of the framework and some local API calls, but the chatbot at least should be shown in the browser.
This works fine for me by linking with my local package. Could it be related to the changes you've done?
It is not the changes I've done to the framework because it happens even without these changes (with your repo).
I just discovered it is something related to the node_modules of the framework and perhaps the node_modules of my project.
When I delete the node_modules folder of the framework, the linking works, i.e., the app runs successfully. The error only happens when the node_modules folder is there.
Maybe it is some conflict between the node_modules of the framework and my project. Also, maybe it is something related to Windows. I need to test this in a Unix system.
Let me know if this rings the bell for you.
Ok, I am having the same problem on a Mac. I solve it if I remove the node_modules folder from the framework.
No idea why this happens. Clearly, the node_modules folder is somehow being used by node when I run my app. There must be some dependency conflicts or so.
The curious thing is that it works for you, so maybe I am doing something wrong.
@FredrikOseberg do you mind describing the process that you followed for linking the framework and testing my application?
Also, I don't know if you have experienced conflicts between the node_modules of different local packages, as it seems I have.
@FredrikOseberg do you mind describing the process that you followed for linking the framework and testing my application?
Also, I don't know if you have experienced conflicts between the node_modules of different local packages, as it seems I have.
yarn link
yarn link react-chatbot-kit
yarn
and yarn start
I can't say I've ran into this issue before. It's an interesting one. I'll try to replicate with a fresh clone when I find the spare time.
Hi Fredrik,
Great framework. It's been quite useful for us.
This is just a question. Not an issue.
We needed to modify the framework to meet our needs. I am wondering how do you build and test your framework in your machine? Disclaimer: we are not experts in npm, yarn, react, etc.
So, if I have an application (as a different project) that uses the framework, how do I build it and use it in my application, as opposed to using the npm package from the web?
So far, we have just copied the generated input.js into the node_modules directory. This seems like a dirty hack.
Any advice would be greatly appreciated.
Thank you.