Urigo / angular-meteor

Angular and Meteor - The perfect stack
https://www.angular-meteor.com/
MIT License
2.36k stars 622 forks source link

Using ES6 on server alongside angular-meteor on client #998

Closed danielflippance closed 8 years ago

danielflippance commented 8 years ago

To use the new ES6 features on the server side I see that we need to have the ecmascript package installed. This was one of the packages removed during the installation of angular-meteor and when I re-install it, I see the following conflict with angular-babel:

error: conflict: two packages included in the app (pbastowski:angular-babel and ecmascript) are both trying to handle *.js

I see that we can disable angular-babel from compiling .js files, but when I try this, my client side views stop working:

https://github.com/pbastowski/angular-meteor-babel/issues/9

Is there a way to resolve this so that I can use ES6 features on the server whilst still using angular-meteor on the client? Can I use the ...babel package on the server somehow? I'm particularly interested in the Proxy feature in ES6.

mgrivera commented 8 years ago

Hi @danielflippance , Do you think angular-babel is not transpiling "server code"? ...

dotansimha commented 8 years ago

I think it should work...

@pbastowski what do you think?

Also, @danielflippance, you can also create a package in your project, that loads ecmascript into your server side only, using imply (http://docs.meteor.com/#/full/pack_api_imply).

Package.onUse(function (api) {
    api.imply('ecmascript', 'server');
});
pbastowski commented 8 years ago

I already have this feature working in a separate branch and even with SystemJS. I'm out shopping right now, but have a look at this: https://github.com/pbastowski/angular-meteor-babel/tree/feature/server-systemjs

pbastowski commented 8 years ago

I haven't completed testing this new branch, which is why it's not released yet.

Update: @dotansimha Yes, it does already work. I just forgot that it did. The new branch adds server side SystemJS support.

pbastowski commented 8 years ago

@danielflippance

I just tested server side ES6 JS compilation and it works for me with the published pbastowski:angular-babel@1.0.7. What version are you using?

Can you please post your .meteor/versions file here?

danielflippance commented 8 years ago

Here it is:

accounts-base@1.2.2
accounts-password@1.1.4
accounts-ui@1.1.6
accounts-ui-unstyled@1.1.8
alanning:roles@1.2.14
angular@1.2.3
angular-meteor-data@0.0.6
angular-templates@0.0.2
angular:angular@1.4.8
angularui:angular-ui-router@0.2.15
autopublish@1.0.4
autoupdate@1.2.4
babel-compiler@5.8.24_1
babel-runtime@0.1.4
base64@1.0.4
binary-heap@1.0.4
blaze@2.1.3
blaze-tools@1.0.4
boilerplate-generator@1.0.4
caching-compiler@1.0.0
caching-html-compiler@1.0.2
callback-hook@1.0.4
check@1.1.0
dburles:mongo-collection-instances@0.3.4
ddp@1.2.2
ddp-client@1.2.1
ddp-common@1.2.2
ddp-rate-limiter@1.0.0
ddp-server@1.2.2
deps@1.0.9
diff-sequence@1.0.1
ecmascript@0.1.6
ecmascript-runtime@0.2.6
ejson@1.0.7
email@1.0.8
es5-shim@4.1.14
fastclick@1.0.7
fortawesome:fontawesome@4.4.0
fourseven:scss@3.4.1
geojson-utils@1.0.4
hot-code-push@1.0.0
html-tools@1.0.5
htmljs@1.0.5
http@1.1.1
id-map@1.0.4
insecure@1.0.4
iron:controller@1.0.12
iron:core@1.0.11
iron:dynamic-template@1.0.12
iron:layout@1.0.12
iron:location@1.0.11
iron:middleware-stack@1.0.11
iron:router@1.0.12
iron:url@1.0.11
jquery@1.11.4
lai:collection-extensions@0.1.4
launch-screen@1.0.4
less@2.5.1
livedata@1.0.15
localstorage@1.0.5
logging@1.0.8
meteor@1.1.10
meteor-base@1.0.1
meteorhacks:async@1.0.0
meteorhacks:npm@1.5.0
minifiers@1.1.7
minimongo@1.0.10
mobile-experience@1.0.1
mobile-status-bar@1.0.6
mongo@1.1.3
mongo-id@1.0.1
npm-bcrypt@0.7.8_2
npm-container@1.2.0
npm-mongo@1.4.39_1
observe-sequence@1.0.7
ordered-dict@1.0.4
pbastowski:angular-babel@1.0.6
promise@0.5.1
random@1.0.5
rate-limit@1.0.0
reactive-dict@1.1.3
reactive-var@1.0.6
reload@1.1.4
retry@1.0.4
routepolicy@1.0.6
service-configuration@1.0.5
session@1.1.1
sha@1.0.4
spacebars@1.0.7
spacebars-compiler@1.0.7
srp@1.0.4
standard-minifiers@1.0.2
templating@1.1.5
templating-tools@1.0.0
tracker@1.0.9
twbs:bootstrap-noglyph@3.3.5
ui@1.0.8
underscore@1.0.4
url@1.0.5
webapp@1.2.3
webapp-hashing@1.0.5
pbastowski commented 8 years ago

ok, that's a whole lot of packages there. I see you have ecmascript in there also. I will try to help you resolve this issue.

First, you need to

meteor remove ecmascript

Then

meteor update pbastowski:angular-babel

I expect it to be updated to 1.0.7.

What do you get now when do the below?

meteor list

Was angular-babel updated to 1.0.7?

pbastowski commented 8 years ago

If it's still not working then I'll need to look at your repo or a repo that reproduces the problem. That will enable me to help you the quickest. We could also do a screen-sharing session.

danielflippance commented 8 years ago

Yeah, strangely I have already removed ecmascript, but it still shows up in .meteor/versions

$ meteor remove ecmascript
ecmascript is not in this project.

It's also not in my ./meteor/packages file:

# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor-base             # Packages every Meteor app needs to have
mobile-experience       # Packages for a great mobile UX
mongo                   # The database Meteor supports right now
session                 # Client-side reactive dictionary for your app
tracker                 # Meteor's client-side reactive programming library
standard-minifiers      # JS/CSS minifiers run for production mode
es5-shim                # ECMAScript 5 compatibility for older browsers.
autopublish             # Publish all data to the clients (for prototyping)
insecure                # Allow all DB writes from clients (for prototyping)
fortawesome:fontawesome
accounts-password
accounts-ui
twbs:bootstrap-noglyph
fourseven:scss
meteorhacks:npm
npm-container
angular
angularui:angular-ui-router
jquery
ddp-rate-limiter
alanning:roles
iron:router
pbastowski commented 8 years ago

OK. Cool.

Let's do a google hangouts right now. Are you able to?

danielflippance commented 8 years ago

I've actually worked around the problem at the moment without having to use Proxy so it's no longer an issue for me at this time. I kept the conversation going in case there was an obvious answer for the community. If you think that a quick investigation of the issue might be useful to the community in general I'd be happy to Hangout, otherwise, I'm OK with leaving it here for now.

pbastowski commented 8 years ago

Let's leave it for now, then. Let me know if you need further help.

danielflippance commented 8 years ago

OK great, thanks for the support @pbastowski