3 ms·
I doubt there is lots of JS code in NPM which is independent of either Node or browser APIs when including transitive dependencies. But that is besides the poin
by PuercoPop 6y ago
I doubt there is lots of JS code in NPM which is independent of either Node or browser APIs when including transitive dependencies. But that is besides the point. I said no NPM as in no access to NPM. Not just no node APIs. Let's say you install a library from npm using either npm or yarn. Its downloaded into the node_modules directory. how would you require it as an es6 module?
Another poor design from the GNOME team. How is the JS code in the gnome extension distributed? It is embedded in .so files! so much for hackability. (I learned this when upon a fresh Ubuntu install I run into bug in my gnome shell version which was a one liner fix but I couldn't find the file in the backtrace.)
- cycloptic 6y agoI haven't tried this with any node modules but you should be able to set imports.searchPath to include your node_modules folder, at least for testing: https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/Modules.md#more-about-imports https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/Modules... Since there is no inbuilt support for Node APIs this will probably only work with modules that have no dependencies and are built into a single file. ES6 module support is WIP and ongoing: https://gitlab.gnome.org/GNOME/gjs/-/issues/328 https://gitlab.gnome.org/GNOME/gjs/-/issues/328