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

Install core-js as Meteor package #102

Open
jthomaschewski opened this issue Oct 16, 2015 · 11 comments
Open

Install core-js as Meteor package #102

jthomaschewski opened this issue Oct 16, 2015 · 11 comments

Comments

@jthomaschewski
Copy link
Contributor

I recently discovered this Meteor package: https://github.com/xolvio/meteor-core-js
It provides core-js for Meteor with number constructor disabled etc.

Maybe it's a good idea to use a package like this instead of build core-js in the scripts? It would simplify the build process a bit.

@jedwards1211
Copy link
Owner

I guess so. I really loathe how Meteor packages lag behind their npm counterparts...and I hope Meteor eventually fixes their check to work with the core-js Number polyfill. But we could do this

@AdamBrodzinski
Copy link
Collaborator

Just my 0.02 but I would prefer building from NPM... I can't stand using Atmosphere wrapper packages. In my app I disabled the build core-js on every start (for speed and stability) and can manually bump it if needed by re-building.

However, since xolvio is tied to Velocity I imagine it will be kept up to date (unlike Moment.js 😦 )

At any rate i've been using Phoenix instead of Meteor for new apps so I don't really care that much 😜 (super glad to have this on my 'legacy' meteor apps though!)

@rclai
Copy link
Contributor

rclai commented Oct 16, 2015

@AdamBrodzinski how are you liking Phoenix?

@jedwards1211
Copy link
Owner

I was just trying to use Velocity with Webpack. Unforunately I haven't figured out any good way to get Webpack to make a separate test bundle require modules from the main app bundle, which is extremely lame.

@AdamBrodzinski
Copy link
Collaborator

@rclai so far it's blissful 😆 Email/PM me if you want to know more (don't want to derail the issue)

@jedwards1211 Yea the only work around have I used was to make a global _Test namespace and then after exporting the module, insert it into the namespace like _Test.convertFoo = convertFoo;. I'm super annoyed with Velocity lately and never bump the version (a month ago starting a new project with Velocity would error out 😦 )

@jedwards1211
Copy link
Owner

@AdamBrodzinski I ended up going to some lengths to be able to put my jasmine tests into the webpack bundle, so that they can require and use all ES6 features, but still work in Velocity. It took some work...I wrote a webpack loader that wraps the test modules in function(jasmine) and inside the function sticks the variables in jasmine.getEnv() back on the local scope using eval. Then I wrote another module that uses require.context to find all of the test modules, require them, and stick them into WebpackTests['client/integration'] etc. which is a package-scoped variable in my test Meteor package. That package then gets those functions and calls them with jasmine. Relatively clean...but I'm still not super impressed with Velocity. As far as unit tests I'm just going to run Jasmine directly

@AdamBrodzinski
Copy link
Collaborator

@jedwards1211 cool, sounds like a major pain in the ass! I've unfortunately lost faith in Velocity. It's so complicated that it never works reliably. I never upgrade it unless something won't work lol. It's also bottlenecked by MDGs build tool speed.

Luckily i've been getting into FP so it's been much easier to unit stuff now that i'm not using classes as much.

Here's one solution I came up with to expose a module in developent mode for testing or in the shell. It checks if it's in dev and if so saves the module to a global namespace:

function exposeInDev(moduleName, module) {
  if (__DEV__) {
    Globals[moduleName] = module;
  }
  return module;
}

const Recipes = new Mongo.Collection('recipes');

export default exposeInDev('Recipes', Recipes);

@jthomaschewski
Copy link
Contributor Author

Meteor 1.2.1 is out and they added more polyfills for es6 features like Object.assign, Map, Set....
For me this is sufficient for now and I don't need any additional core-js/... package.

@jedwards1211
Copy link
Owner

Are they rolling their own?? Instead of using core-js?

@zloirock
Copy link

zloirock commented Nov 6, 2015

@jedwards1211
Copy link
Owner

I will have to investigate that further since the ecmascript package tends to hang on large JS bundles (meteor/meteor#5275)

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

5 participants