I've looked into loading Espruino modules straight from
espruino.com/modules, and while that seems possible, I think It will
have to wait untill I actually need is, I have enough on my plate as
it is.
If someone else wants to give it a shot, the relevant Rollup hooks
appear to be resolveId and load.
It is generates a default config for Espruino which currently also does minification by default. It is just a first shot as it needs refinement with regards to configuration possibilities but it works quite nicely. It downloads the modules into the local ./modules folder
By using the import statements in the app code one can get use of tree shaking so that e.g. the SSD1306 driver's connectSPI is not bundled when not used.
caveat: I haven't tried the resulting bundles on-board yet.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
https://github.com/opichals/rollup-plugin-espruino-modules (not published to npm yet).
It is generates a default config for Espruino which currently also does minification by default. It is just a first shot as it needs refinement with regards to configuration possibilities but it works quite nicely. It downloads the modules into the local
./modules
folderI converted the webpack/babel example to use this and babel 7.x here https://github.com/opichals/espruino-rollup-babel-sample
By using the
import
statements in the app code one can get use of tree shaking so that e.g. theSSD1306
driver'sconnectSPI
is not bundled when not used.caveat: I haven't tried the resulting bundles on-board yet.