charting-library-examples: react-javascript example does not work in production.

When I run yarn build followed by serve -s build to start the example in production mode, the example does not work. Here is the error that shows up:

screen shot 2018-05-08 at 1 35 15 pm

There is no error when simply running yarn start.

The error seems to be similar to #1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 25 (13 by maintainers)

Most upvoted comments

You even can try to do the following:

  1. cd build
  2. serve (without -s build)

And this works fine.

Would be nice to have something like:

Thanks you, @mogenshoj! I’ve created issue in the charting_library repo for this - https://github.com/tradingview/charting_library/issues/3750.

Some insights for anyone having this issue.

The problems comes from the iframe not loading the correct html file. The widgetReady function is defined in the iframe, if the iframe loads a 404 this error will show up.

Would be nice to have something like:

if (typeof i.contentWindow.widgetReady === 'undefined') {
  throw new Error('The iframe does not appear to have loaded correctly, please check your paths');
}

It would limit the number of support requests and make the error more understandable.

To solve: Inspect the iframe and verify that the src points to a file that exists. Possibly set the library_path config attribute to point the the correct folder containing the library files, if you’re not using the standard configuration.

When i run serve (without -s) command, Routing client has a problem. It shows “the requested path route could be not found”. Anyone has the same issue ?

@timocov thanks. It’s works for me.

Or even serve build works well too (without -s - I do not know why somebody decide that we need to add this flag).