Comments (22)
I think webpack breaks in some way the Meteor runtime, the code below works in any classic Meteor app
./met shell or $ meteor shell
> var whatever = new Mongo.Collection("whatever")
> whatever.find().fetch()
[]
> whatever.find({},{limit:5}).fetch()
Error: Match error: Failed Match.OneOf or Match.Optional validation
at checkSubtree (packages/check/match.js:244:1)
at check (packages/check/match.js:32:1)
at [object Object]._.extend._getFindOptions (packages/mongo/collection.js:239:1)
at [object Object]._.extend.find (packages/mongo/collection.js:275:1)
at repl:1:11
from meteor-webpack-react.
related to Meteor Babel #5 , it's a conflict with core meteor package "check"
check(5, Number)
Error: Match error: Expected Number
at checkSubtree (packages/check/match.js:252:1)
at check (packages/check/match.js:32:1)
at repl:1:2
a workaround is:
check(5, Number(5))
But it is used in many situations
from meteor-webpack-react.
Aha, "good to know" as you said :) Okay, this has me pissed at Meteor; why do they think they need to check that the programmer gave you a Number for the limit? There's no good reason! People need to relax and let duck typing do its work,. If the programmer says {limit: "5"} it's still perfectly valid to interpret that as 5. If the user says {limit: true} it would end up limiting to 1, but who cares?? They could just explain in the docs that whatever the programmer provides will be converted to a number according to usual JS rules.
from meteor-webpack-react.
{limit: Number(5)} doesn't seem to be working for me unfortunately. I'll have to look at how to incorporate the custom build you did...
from meteor-webpack-react.
I confirm Number(5) hack doesn't work with mongo collections, unfortunatly check(..)
is used everywhere in Meteor,.. limit, subscriptions,.. also on parameters hardcoded server-side XD
from meteor-webpack-react.
Hmm how do they get around this using the core babel and core-js? Must be using a custom build?
from meteor-webpack-react.
The workaround that worked for grigio:babel is to embed core-js built without ES2015 Number support
from meteor-webpack-react.
in webpack.config.server.js
with
...
module.exports = {
entry: [
// 'babel/polyfill', //disabled
'../app/main_server',
],
...
It seems it is fixed, probably we should load here a polyfill without ES2015 Numbers
from meteor-webpack-react.
I confirm. Disabling 'babel/polyfill' in webpack server fix this particular issue
from meteor-webpack-react.
Thanks for getting to the bottom of this @grigio I'm sure I would have been cursing and banging my head against the wall on this one lol.
from meteor-webpack-react.
I did it :D, I've also tried your example on the Meteor forum but the problem wasn't my code... this is what I meant with side-effects.
@jedwards1211 what do you think is better to do? Disable 'babel/polyfill' on the server or embed a custom polyfill with corejs without ES2015 Number?
from meteor-webpack-react.
I'd definitely rather embed a custom polyfill, as the goal of this project was to enable as many ES6 features as possible. Sorry, I've been busy lately, I can try to work on this later but if you have any idea yet how to work the custom build into this project feel free to make a PR.
from meteor-webpack-react.
Some feature provided by the polyfill may be dangerous numtel/pg-live-select#3
from meteor-webpack-react.
Ah man...I guess I'm not too surprised, given how new all these tools are. Thanks for the heads up on that. It's a bummer...I was hoping to start trying out async
/await
soon.
from meteor-webpack-react.
Yea async/await is really nice... I've been using it on react native lately. They're adding async-await support in the future by converting over to promise based methods. They have a really nice promise polyfill for the server too....actually not quite sure if we can make that work with babel now....I'm sure something would go wrong lol.
from meteor-webpack-react.
Same issue when running the velocity. Commenting out the polyfills works though.
Testing with velocity and jasmine works well so far. You can either put tests in:
meteor_core/tests/jasmine/client/integration/greeting_spec.js
or a more flat path with symlinks
tests/acceptance_client/greeting_spec.js
I don't see any way to symlink them into meteor_core if they're next to the source files in app 😞 The unit tests with the Karma runner allow that though!
At any rate i'll wait until this issue is resolved before pulling these in since they'll break the build step.
from meteor-webpack-react.
Okay guys, I just pushed a script that custom builds core-js, and now it uses that and regenerator/runtime
instead of babel/polyfill
in the webpack entry points. Try it out! Thanks Luigi for pointing me to your solution, otherwise I may never have figured this out!
from meteor-webpack-react.
Awesome! I'll try to push the test stuff on my flight back on Thurs.... will have major down time then lol.
It's a bummer...I was hoping to start trying out async/await soon.
BTW, I just lost some hair using these and not realizing that in current V8 builds any async
function will swallow all exceptions (like undefined vars lol) if it doesn't have a try/catch around the caller. I guess this will be resolved in the future.
from meteor-webpack-react.
Oh wow. Good to know!
from meteor-webpack-react.
And @AdamBrodzinski I don't know if you read much through Luigi's link but basically one guy who was using async/await
had memory leaks that were solved once he stopped using them :(
from meteor-webpack-react.
Yikes.... they're turned on by default in RN in 0.10.0-rc
so maybe the latest babel fixes that? I'll have to keep an eye on memory 👍
from meteor-webpack-react.
I'm going to close this. I just fixed an issue where the new custom build script wasn't getting the core js version correctly. If any more issues come up with the babel polyfill replacement, feel free to open a new issue.
from meteor-webpack-react.
Related Issues (20)
- Stripe integration HOT 1
- Calling configure method of useraccounts package causes error HOT 2
- WebPack Syntax Error on Windows
- Why would dev.js build server only?? HOT 2
- CoffeeScript/ Usage with meteord HOT 2
- How to: Server side debugging? HOT 2
- npm WARN deprecated [email protected]: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0 npm WARN deprecated [email protected]: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0 HOT 3
- TypeError: Cannot read property 'loginButtons' of undefined HOT 4
- Screen stays at "Loading" HOT 2
- mailgun-js HOT 2
- Meteor 1.3 HOT 18
- Adding loaders to webpack.config.client.js HOT 2
- Code splitting doesn't work in production (because only main chunk gets copied to meteor folder) HOT 12
- Cannot import meteor modules HOT 1
- Problem using Elasticsearch HOT 4
- Weird debug issues -- out of the box HOT 1
- [ERROR] Cannot find Cannot find module 'temp' , core-js-no-number when running dev HOT 2
- GET http://localhost:9090/ 502 Bad Gateway HOT 6
- Trying to bundle a pure node.js application HOT 2
- Webpack issue loading static files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-webpack-react.