Open buzzware opened 6 years ago
We don't officially support this, but most of the pieces are there in the dev compiler. You might ask the node-interop folks.
I'm suggesting that the Dart SDK officially support it in future. With some effort from Google, the potential is there for teams to use Dart as their primary language on web, mobile and server, and Google will be rewarded with Firebase subscriptions. This is one step towards enabling wider adoption of the language.
Dart is promoted as being a better way to build web and mobile apps, but when I tried to create an npm package for use in an Ember.js project, I had all sorts of problems.
1) I haven't found one article describing how to create an npm package with Dart. I've been using https://github.com/pulyaevskiy/node-interop/tree/master/build_node_compilers and found some repos using it. It doesn't seem to be a supported way to go 2) Ideally, I would write my classes in .dart files, and then run a build script that outputs : a) readable es6 or commonjs modules matching each of my dart files 1 for 1, without any included package code concatenated b) a minimum dart stdlib in js - either a small common core, or the full one tree-shaken to what my code uses c) javascript versions of any packages I've used d) an entry point file tying the above together 3) an example could be added to stagehand
Supporting the building of npm would make Dart an attractive option for writing libraries that are reusable by Dart VM, node, most frontend web frameworks and Flutter.