Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React: Can't resolve '../../charting_library/charting_library.min' #192

Closed
1 task done
bfriel opened this issue Nov 5, 2020 · 10 comments
Closed
1 task done

React: Can't resolve '../../charting_library/charting_library.min' #192

bfriel opened this issue Nov 5, 2020 · 10 comments

Comments

@bfriel
Copy link

bfriel commented Nov 5, 2020

Checklist

  • This issue is NOT related to the charting library itself

Describe the bug

I am unable to compile the React Integration Example. After following the four steps under the "How to Start" section, I see the following error:

./src/components/TVChartContainer/index.jsx
Module not found: Can't resolve '../../charting_library/charting_library.min' 

To Reproduce

Steps to reproduce the behavior:

  1. Clone the repo
  2. Go to react-javascript folder
  3. Run npm install
  4. Copy charting_library from https://github.com/tradingview/charting_library/ (Release v17.021) to /public and /src folder
  5. Copy datafeeds folder from https://github.com/tradingview/charting_library/ (Release v17.021) to /public
  6. Run npm start
  7. See error

Expected behavior

The example would compile

Screenshots

N/A

Additional context

N/A

@eugene-korobko
Copy link

Hello!

It looks like the sampe is looking for minimized build of the library.
Could you please check your ./src/charting_library folder if it has 'charting_library.js' or 'charting_library.min.js'
If it has charting_library.js, just change ./src/components/TVChartContainer/index.jsx file with replacing 'charting_library.min.js' with 'charting_library.js'

@bhp-work
Copy link

bhp-work commented Nov 6, 2020

I am also facing the same issue! I replaced the file as suggested by eugene-korobko , but still error is there.

@eugene-korobko
Copy link

Hello!

Could you please check what charting_library* files are in the ./src/charting_library folder?

@bhp-work
Copy link

bhp-work commented Nov 6, 2020

oops! I guess I have put charting_library and datafeed in 'public' folder and not in 'src' folder.
I cloned the charting library again and now I have the charting_library/charting_library.min.js file. But the error is still there.

@eugene-korobko shall I move the charting_library inside src folder?

@eugene-korobko
Copy link

eugene-korobko commented Nov 6, 2020

Hello!

According to the readme.md file,

  1. Copy charting_library folder from https://github.com/tradingview/charting_library/ to /public and to /src folders. The earliest supported version of the Charting Library is 1.12. If you get 404 then you need to request an access to this repository.
  2. Copy datafeeds folder from https://github.com/tradingview/charting_library/ to /public.

So, do you have charting_library.min.js or charting_library.js file in the src/charting_library ?

@bhp-work
Copy link

bhp-work commented Nov 6, 2020

Hi,

Now I have copied charting_library to /public AND to src folder.
Module error is resolved, but its throwing error on page

I have charting_library.min.js file in the src/charting_library.

crp

@bhp-work
Copy link

bhp-work commented Nov 6, 2020

Hello,

My error is resolved. Below paths worked for me....

public/index.html =>
<script src="charting_library/datafeeds/udf/dist/polyfills.js"></script> <script src="datafeeds/udf/dist/bundle.js"></script>

src/components/TVChartContainer/index.jsx =>
import {widget} from '../../charting_library/charting_library.min';

Also I compiled the project using below commands. But this compilation is not really necessary.
PS D:"ProjectFolderPath"> cd D:"ProjectFolderPath"\public\datafeeds\udf
npm install -g rollup
npm install --save-dev rollup-plugin-buble
npm i rollup-plugin-uglify
npm install --save-dev rollup-plugin-node-resolve
npm run compile
npm run bundle-js
PS D:"ProjectFolderPath"> npm start

Happy coding!

@bfriel
Copy link
Author

bfriel commented Nov 6, 2020

Hi @eugene-korobko ,

I was able to compile by switching the link from charting_library.min to charting_library.js. I should note, however, that this also threw a 'define' is not defined error outlined here. I was able to resolve that by referencing this comment.

I have no further issues, but I hope that someone else will find this if they also come across this error.

@bfriel bfriel closed this as completed Nov 9, 2020
@Nicol0rd
Copy link

Hi is there a way to get a copy of the charting_library and datafeed folders?

@edew
Copy link
Contributor

edew commented Aug 12, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants