O
O
odarlanen2021-04-28 20:08:06
JSON
odarlanen, 2021-04-28 20:08:06

How to include libraries from JSON?

A complete noob in JS is in touch.

Given:
1. Here is the effect on codesandbox: https://codesandbox.io/s/9gyz8
2. I am trying to run this effect on my site
3. If I stupidly transfer all files from codesandbox.io to my hosting, the effect does not work.

I guess the reason is that the three.js and gsap libraries are specified in the package.json file, which are somehow magically launched from within the codesandbox.

Question: Is it possible to get rid of package.json by including the necessary libraries through regular <script src="...">?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2021-04-28
@udjin123

It is possible, but this is not enough, more additional manipulations will be needed. And just in order not to do it all by hand, there are tools that do it all automatically.
Therefore, it is better to install nodejs, then the npm or yarn package manager and "build" what you want (how to do this is full of instructions on the Internet), as a result, the output will be one javascipt file, which you can easily insert into your site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question