I am working my way through Eric Elliott’s book Programming JavaScript Applications. In it he uses stampit.js (https://github.com/stampit-org/stampit). I downloaded stampit.js and tried to use it with the book's examples, but I’m getting nowhere. Whenever I try to load stampit.js from a script tag, all browsers report “unexpected reserved word” on the very first line: “import forEach from 'lodash/collection/forEach’;” I also get the same error from the command line with qunit.
I’m clearly missing something. I’ve tried to run the tests that come with stampit 2.1.0 and they fail with the same error:
$ cd ~/Downloads/stampit-2.1.0/test
$ qunit -c init.js -t init.js
Testing /Users/thad/Downloads/stampit-2.1.0/test/init.js ... {
[Error: /Users/thad/Downloads/stampit-2.1.0/test/init.js:1 (function
(exports, require, module, __filename, __dirname) { import stampit f
^^^^^^ Unexpected reserved word] message:
'/Users/thad/Downloads/stampit-2.1.0/test/init.js:1\n(function
(exports, require, module, __filename, __dirname) { import stampit f\n
^^^^^^\nUnexpected reserved word' }
Can someone tell me what I’m doing wrong?