Well it’s well and good but it still doesn’t answer how we can import html files when using Blaze (on packages or if you create your own NPM package or Meteor package).
I think the JSX has its own import keyword and parsing that is different from CommonJS or from the ECMASCRIPT2015 specs. It’s clashing with each other.
Has anyone tried importing underscore from node_modules? It seems like instead of importing the correct underscore package from npm install, the default underscore package by Meteor is being imported.
The good news, however, is that npm installed Lodash is working fine and you can use it like how you did in normal node.js apps.
You can run cat .meteor/release and it will print out what version you’re on. You can always use older versions. Also using 1.3 without using the import keyword works fine on older apps. It will still use the older load order.
Yeah its seems jsx can only use the require syntax, not the es6 import sytnax (still learning react). Doesn’t seem like the comsos:browserify package will work with getting packages from the node_modules folder. I think its expecting a meteorhacks:npm configuration.
I wanted to use the browserify package because I was getting similar errors as ngochenbang above with process is not defined errors from react. My initial research seems to show that react is expecting a bundler like webpack or browserify to set these variables.
I’ll keep fiddling. I’m simply trying to get a base project with react and using react components from npm. I see the webpack option but just seems like overkill.
Just read this from the read-me:
Note: in the beta release of Meteor 1.3, Node modules are imported using the same entry point on both the client and the server (either the module identified by the main field of the package.json file, or index.js). For this reason, you should only import npm libraries on the client if you are sure they will work in a browser environment. We are considering implementing support for the browser field in package.json files, but we didn’t want to delay the beta release just for that
"Nevertheless, the modules package is totally optional, and it will be up to you to add it to existing apps and/or packages.
For apps, this is as easy as meteor add modules, or (even better) meteor add ecmascript, since the ecmascript package implies the modules package."
With Meteor 1.2 the ecmascript package is included by default, so does that mean that existing meteor 1.2 apps get modules by default after upgrading to 1.3? That would appear to contradict the first sentence.
It’s just noting that ES5 CommonJS modules work without ecmascript. Modules are part of the spec, so ecmascript should definitely imply them. Not sure if MDG see any value in doing core packages with feature subsets, since it’s only there as a stopgap until the need for transpilation disappears. Maybe. If not, and if it’s important enough, you could just use and maintain your own package?
There is a distinction to be made between “lazy” loading, and dynamic loading (or code spliting), which is not mentioned in the documentation.
It would be easy to mistake lazy loading being talked about in the documentation for dynamic loading a la Webpack’s require.ensure and think that incremental loading exists now. As far as I know, you cannot do an import statement in the middle of your code.
.jsx file in meteor is compiled into plain Javascript through this jsx build plugin and it seems like this build plugin only transpiles some of the ES6 features so my guess is import/export is not one of those ES6 features.
You guys might try not using the packages react-runtime, and jsx and just stick with react-meteor-data to retain the mixin.
Then just use npm react. I’ll try it out today and see if it works.
My bad. I tried removing the jsx package but it didn’t work. The jsx files were not transpiled to js even when using just the ecmascript from Meteor 1.3