Tradingview chart not working
omgvamp opened this issue · 8 comments
I get the following error when running yarn start
:
Uncaught TypeError: i.contentWindow.widgetReady is not a function
at HTMLIFrameElement.n (charting_library.min.js:1)
I found multiple issues referring to this problem:
- tradingview/charting-library-examples#56
- tradingview/charting-library-examples#18
- tradingview/charting-library-examples#15
Tried all the suggestions, but still can't manage to make it work. Was hoping someone knows how to fix this.
Update: fixed
How did you fix it?
@kolyabamberg you using React? Disable the built in service worker. If you need a service worker you’ll need to find a different solution or figure out how to disable the service worker for the trading view library folder in the public directory.
Check this solution, it worked for me: tradingview/charting-library-examples#110 (comment)
If anyone still having the same issue, this is how I managed to fix it.
As far as my knowledge goes, the problem occurs because react rewrites static files in production and cannot access charting_library directory.
Since we are running the production server with serve, we need to configure it a bit.
- install
serve-handle
dependency. here is it's documentation - create a file named
serve.json
in thepublic
directory (same level as your index.html file)
3 copy the following code into your newly created file
{
"cleanUrls": false
}
Now you should re-build your application and re-run you server.
After these changes I managed to use the -s flag and TradingView together, without any issues.
Hope this will help someone and save you some valuable time.
If anyone still having the same issue, this is how I managed to fix it.
As far as my knowledge goes, the problem occurs because react rewrites static files in production and cannot access charting_library directory.
Since we are running the production server with serve, we need to configure it a bit.
- install
serve-handle
dependency. here is it's documentation- create a file named
serve.json
in thepublic
directory (same level as your index.html file)
3 copy the following code into your newly created file{ "cleanUrls": false }
Now you should re-build your application and re-run you server.
After these changes I managed to use the -s flag and TradingView together, without any issues.Hope this will help someone and save you some valuable time.
yeah, I want to may thank you for your comment.
If anyone comes across this thread searching for a similar answer - make sure you have both sets of library folders in your public folder: charting_library
and datafeeds