opensourceBIM / bimvie.ws

Javascript client for Building Information Modelling, using open standards like IFC, BCF and BIMSie. Using Bootstrap, BIM Surfer, etc..
GNU Affero General Public License v3.0
170 stars 85 forks source link

Javascript error in Bimvie.ws: expected expression, got keyword 'import' #97

Closed themeshpotato closed 6 years ago

themeshpotato commented 6 years ago

I have set up a BIMServer v. 1.5.92 and run through the setup. I can access the Console and create projects and checkin ifc-files easily. But when it comes to launching bimvie.ws I get the following error message in the browser console: expected expression, got keyword 'import' The error is at the following line bimviews:113 if that helps.

rubendel commented 6 years ago

Which browser are you using?

themeshpotato commented 6 years ago

I was initially using Chrome. But tried it in the newest version of Firefox and on Safari on a Mac too.

marknelissen commented 6 years ago

I confirm the issue in Chrome 62 on Windows 10 64-bits with bimserver (and thus the plugin) running on openjdk 1.8.0_151.

themeshpotato commented 6 years ago

I just tried it on another computer where I tried both Firefox Quantum 57.0 and Chrome Version 62.0.3202.94. Same error :(

qiaolin-li commented 6 years ago

我也是,我也是,求帮助

themeshpotato commented 6 years ago

I just realized that the bimserverjavascriptapi is imported with dynamic import when used in bimvie.ws, which only works with beta- or dev-versions of Chrome as far as I can tell. I got past the error when using the dev-version, but the BimServerClient-object is undefined after import. Am I doing something wrong or is there a version mismatch? screen shot 2017-11-27 at 10 00 31

rubendel commented 6 years ago

I was a bit enthusiastic using the dynamic loading feature, I'll try and come up with a fix that uses static loading (but still uses ES6 modules)

themeshpotato commented 6 years ago

Okay, well, it's always nice to use great new language features 👍 Do you have an estimate on when you'll probably have a build with a fix?

rubendel commented 6 years ago

Alright that's fixed, when you install a new 1.5.92 version of BIMserver (unchanged release), it will install newer versions of the JS API and BIMvie.ws that will work on Chrome 62.

themeshpotato commented 6 years ago

Thanks for the quick fix! Sadly I still get a "Loading BIMviews..." and in the Chrome console I get a "Uncaught SyntaxError: Unexpected token import". I did a fresh install of the BIMServer. On my Mac I can get BIMvie.ws working in Safari.

yiqunc commented 6 years ago

Thanks Ruben! I noticed your changes in BIMviews repo on github, and redownloaded the bimserver war file and did a fresh install, but the same issues are still there (404 - Not Found for apps/bimsurfer/ and showing "Loading BIMviews..." with this error in console:

capture ).

I am using Google Chrome Version 62.0.3202.94 (Official Build) (64-bit) on Windows 7. Browser cache is cleaned before reloading. Here is the list of plugin installation logs:

Installing plugins... Installing bimsurfer... Successfully installed BIMsurfer (org.opensourcebim:bimsurfer:0.0.43)

    Installing bimviews...
    Successfully installed BIMvie.ws (org.opensourcebim:bimviews:0.0.94)

    Installing ifcopenshellplugin...
    Successfully installed IfcOpenShellPlugin (org.opensourcebim:ifcopenshellplugin:0.5.25)

    Installing ifcplugins...
    Successfully installed IfcPlugins (org.opensourcebim:ifcplugins:0.0.33)

    Installing binaryserializers...
    Successfully installed BinarySerializers (org.opensourcebim:binaryserializers:0.0.27)

    Installing bimserverapi...
    Successfully installed BIMServer JavaScript API (org.opensourcebim:bimserverapi:0.0.128)

    Installing console...
    Successfully installed Console (org.opensourcebim:console:0.0.10)

    All remote plugins successfully installed
qiaolin-li commented 6 years ago

I put the Google browser to upgrade to the 62 or not

qiaolin-li commented 6 years ago

Trouble you to update the, or tell me the latest stable version. And what's the use of installed bimsurfer, as well as the benefits of the plug-in installed.Thank you for the

rubendel commented 6 years ago

Alright, sorry for the hassle. The newest builds of BIMvie.ws and the JavaScript API will work again, it was just a bit too early for using the EcmaScript 6 module system so using a transpiled version for now.

xie-qianyue commented 6 years ago

Hello Ruben, after updating to the latest version (commit aa9e3efcb83eb688f05d5fb77860b0204414fa32), this error occurs again. I use Chrome (version 62.0.3202.94) on Windows 10.

pierrejoye commented 5 years ago

For the record here, this error still occurs, I use: bimserverwar-1.5.92.war org.opensourcebim.bimviews-0.0.119.jar

It is trying to load: :8080/apps/bimserverjavascriptapi/bimserverclient.js and :8080/apps/bimserverjavascriptapi/bimserverapipromise.js

Which is actually: *:8080/BIMserver/apps/bimserverjavascriptapi/bimserverapipromise.js (with eventually the version)

Also the code could use configuration and co to take care of the paths of the different libraries and co, that would avoid that issue to happen again and make it easier to maintain :)

Maybe an important note, I use *:8080/BIMserver/apps/bimserverjavascriptapi/ to see where is everything exposed from a JS files pov. And it seems to work and all files are accessible. That suggests the issue is not in the javascriptapi but bimvie.ws (the code around the suspected commit seems to be the gulty part).

update. my bad, just realized I was not using latest. Not useless effort with the proxy, added some cache :)

update #2: same error with latest (.120), even worst, most plugins do not seem to be installed either (the index page does not show them as it used to do in the previous version)

pierrejoye commented 5 years ago

For other having the issue, I am simply putting a proxy in front of BIMserver instance and add rewrite rules for the various version of the bugs as I am not inclined to custom monkey patch each version of it, and easy to add new rules for future similar bugs :)

`server { listen 80; server_name ~^(.+)$;

location ~* \.(eot|ttf|otf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin *;
}
location /BIMserver/stream {
    proxy_pass http://bimserver:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
}
location / {
    rewrite ^/apps/bimserverjavascriptapi(.*) /BIMserver/apps/bimserverjavascriptapi/$1 break;
    proxy_pass         http://bimserver:8080;
    proxy_redirect     off;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;
}

}`

location ~* \.(eot|ttf|otf|woff|woff2)$ needs tweaks (not working using this config, but all the rest seems to work. For those interested.