web-ifc-viewer icon indicating copy to clipboard operation
web-ifc-viewer copied to clipboard

issues updating example/main.js for tests

Open fspegni opened this issue 3 years ago • 4 comments

Hi,

I'm doing some attempts to modify the example/main.js file, and then try to re-build it into the builds/main.js file and serve it. This is what I do, so far:

  1. download git repository
  2. cd example
  3. npm install
  4. npm start
  5. open the browser at localhost:5000 and see that everything works as expected
  6. in a separate editor, change the index.js file with custom console.log (nothing fancy so far)
  7. on a terminal, cd example again, and then: npm run build
  8. refresh the browser, and get the following error in the web browser console
Uncaught ReferenceError: webIfcViewer is not defined

In fact, if I do git diff build/main.js I see they look very different, after the npm run build script. Am I doing something wrong here? How am I expected to update and refresh the web app example?

fspegni avatar May 11 '22 13:05 fspegni

Hi, this repository uses yarn. Try something like:

  1. yarn install
  2. cd example

And then serve it however you like. I use reload (npm library) but any other option should do. To rebuild the example, you can also run yarn build in the example folder. Cheers!

agviegas avatar May 11 '22 13:05 agviegas

@fspegni, was your problem solved?

aka-blackboots avatar Dec 03 '22 12:12 aka-blackboots

@aka-blackboots In fact, the problem changed: now I don't get any error after npm run build, but when I restart the server (npm start) and reload the browser window (http://localhost:5000) I don't see any control for uploading IFC files or "play" with them.

Note that in the original issue I mentioned some modifications (i.e. adding a console.log(...) line) to index.js, but I guess I meant (examples/main.js).

fspegni avatar Dec 05 '22 07:12 fspegni

@fspegni, please use the below steps. (Project uses yarn)

  1. Clean the node_module, then
  2. In the main repo, run the command yarn init-repo (This will build and add packages)
  3. Navigate to example directory cd example
  4. Edit main.js and build example again using yarn build
  5. Run example using yarn start and visit http://localhost:5000

I tried these steps and was able to edit main.js and see the side toolbar as well

aka-blackboots avatar Dec 06 '22 05:12 aka-blackboots