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

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

Closed
themeshpotato opened this issue Nov 24, 2017 · 17 comments
Closed

Comments

@themeshpotato
Copy link

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.

@themeshpotato themeshpotato changed the title Javascript error in Bimvie.ws Javascript error in Bimvie.ws: expected expression, got keyword 'import' Nov 24, 2017
@rubendel
Copy link
Member

Which browser are you using?

@themeshpotato
Copy link
Author

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

@marknelissen
Copy link

marknelissen commented Nov 25, 2017

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
Copy link
Author

themeshpotato commented Nov 25, 2017

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
Copy link

我也是,我也是,求帮助

@themeshpotato
Copy link
Author

themeshpotato commented Nov 27, 2017

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
Copy link
Member

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
Copy link
Author

themeshpotato commented Nov 27, 2017

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
Copy link
Member

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
Copy link
Author

themeshpotato commented Nov 27, 2017

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
Copy link

yiqunc commented Nov 28, 2017

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
Copy link

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

@qiaolin-li
Copy link

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
Copy link
Member

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
Copy link

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

@pierrejoye
Copy link

pierrejoye commented Jan 25, 2019

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
Copy link

pierrejoye commented Jan 25, 2019

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.

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

7 participants