Comments (11)
./met add aPackage
And you have it globally exposed
from meteor-webpack-react.
Thank you, but i guess there is no way atm to require it (like universe:modules does), to make the typescript compiler happy ?
from meteor-webpack-react.
There is a bug open about typescript, basically you import or require npm modules where you need or you install packages a la Meteor way and you use the function globally exposed
from meteor-webpack-react.
Ok, thanks.
from meteor-webpack-react.
@vjau as far as making the typescript compiler happy... could you have a file called packages.js and then do something like this?
// packages.js
export const Meteor = Meteor;
export const SimpleSchema = SimpleSchema;
export const FlowRouter = FlowRouter;
// somewhere else
import FlowRouter from '../../packages/FlowRouter';
// or with an alias
import FlowRouter from 'packages/FlowRouter';
from meteor-webpack-react.
@AdamBrodzinski : actually, the idiomatic way to do that in Typescript when the variables are global and comes from a js (= not TS) file, is to use some "ambient" declarations in a d.ts file.
The question about "requiring" the meteor packages was more about the better scope control this would have given over "everything in global" import.
However i guess we will have to wait for MDG to provide a proper solution, hoping they will make the most compatible (not too meteorish...) choice.
I wonder if it would be doable to write a meteor package loader for webpack, that would somehow transpile (build) the files in the package in a single ES6 module that would have the correct exports.
from meteor-webpack-react.
@vjau ah I see! thanks for clearing that up!
I wonder if it would be doable to write a meteor package loader for webpack, that would somehow transpile (build) the files in the package in a single ES6 module that would have the correct exports.
Perhaps but since MDG will do this eventually it's easier to just leave them global and use a few packages as possible and require NPM modules when available (like Moment or Ramda, etc..)
Have you had a look at the typescript PR yet? Have you been able to get hot loading to work with TS? This PR adds support for manual compiling and the 2nd commit includes a loader but no hot loading:
#43
from meteor-webpack-react.
Actually, my tsx files are transpiled by Atom to jsx, i don't use the webback typescript loader.
Sometimes i have to reload the page so that it updates correctly, but i don't think this is typescript related, since for all webbpack knows, it's a regular jsx project.
from meteor-webpack-react.
Ah gotcha. That's how the the PR author did it as well... built to dist/ and required the js from dist.
Off topic but have you used Facebook's Flow yet? It looks interesting and I was thinking about using it since it's fairly easy to integrate into current projects.
from meteor-webpack-react.
I have tried flow, but i gave up since it doesn't support source files with unicode and won't for sometime.
Also webstorm doesn't support it atm and should not support it either in next version. It's still pretty experimental.
I think atm that Typescript has a stronger momentum.
Eventually, i guess (hope) we will have type support in ES8, and that we won't need those sideprojects anymore.
from meteor-webpack-react.
My goal for this project isn't to provide a require
alternative for using meteor packages...just to be able to use it in my own code and avoid the meteor ecosystem as much as possible. If you want to use Meteor packages with this, best use them the Meteor way. I don't have time to experiment with doing anything like rocket:module
or universe:modules
does, but I'd be happy to accept PRs!
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.