jedwards1211 / meteor-webpack-react

(DEPRECATED) use jedwards1211/crater instead
https://github.com/jedwards1211/crater
374 stars 75 forks source link

Install core-js as Meteor package #102

Open jthomaschewski opened 8 years ago

jthomaschewski commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 :frowning: )

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

rclai commented 8 years ago

@AdamBrodzinski how are you liking Phoenix?

jedwards1211 commented 8 years ago

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 commented 8 years ago

@rclai so far it's blissful :laughing: 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 :frowning: )

jedwards1211 commented 8 years ago

@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 commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

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

zloirock commented 8 years ago

@jedwards1211 they just included core-js in the ecmascript package :)

jedwards1211 commented 8 years ago

I will have to investigate that further since the ecmascript package tends to hang on large JS bundles (https://github.com/meteor/meteor/issues/5275)