web-ifc-viewer
web-ifc-viewer copied to clipboard
issues updating example/main.js for tests
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:
- download git repository
cd examplenpm installnpm start- open the browser at
localhost:5000and see that everything works as expected - in a separate editor, change the
index.jsfile with customconsole.log(nothing fancy so far) - on a terminal,
cd exampleagain, and then:npm run build - 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?
Hi, this repository uses yarn. Try something like:
yarn installcd 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!
@fspegni, was your problem solved?
@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, please use the below steps. (Project uses yarn)
- Clean the node_module, then
- In the main repo, run the command
yarn init-repo(This will build and add packages) - Navigate to example directory
cd example - Edit
main.jsand build example again usingyarn build - Run example using
yarn startand visithttp://localhost:5000
I tried these steps and was able to edit main.js and see the side toolbar as well