Yes, it just needs a plugin to handle that and as the showcase is to actually use the ES6 import they just don't have it in (rollup-plugin-commonjs). I had a look at that and it would require changes to be able to work in the browser but nothing too complicated IMO. Also the terser (uglifyjs-es successor) should not be a big problem to put in.
In order to use the tree shaking functionality though the ES6 import needs to be used (more on that here https://rollupjs.org/guide/en#tree-shaking). That I find quite fine to use in the application code. The modules usually do not import other module parts. We could go even further IMO perhaps as far as saying that const connect = require('SSD1106').connect is the same as import { connect } from 'SSD1106'; (but that is just a thought for the future implications of which would have to be investigated first).
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.
Yes, it just needs a plugin to handle that and as the showcase is to actually use the ES6
import
they just don't have it in (rollup-plugin-commonjs
). I had a look at that and it would require changes to be able to work in the browser but nothing too complicated IMO. Also theterser
(uglifyjs-es successor) should not be a big problem to put in.In order to use the tree shaking functionality though the ES6 import needs to be used (more on that here https://rollupjs.org/guide/en#tree-shaking). That I find quite fine to use in the application code. The modules usually do not import other module parts. We could go even further IMO perhaps as far as saying that
const connect = require('SSD1106').connect
is the same asimport { connect } from 'SSD1106';
(but that is just a thought for the future implications of which would have to be investigated first).It is used for the
import * as xyz
functionality and there theObject.freeze
use can be turned off (see an example in the repo at https://github.com/rollup/rollup/blob/c3228cde9f4358ec08c349bef123b3289e33b8d3/test/form/samples/freeze/_config.js)