popeindustries / lit-html-server

Render lit-html templates on the server as Node.js streams
MIT License
265 stars 12 forks source link

SyntaxError: Unexpected token * #119

Closed JeremyBernier closed 4 years ago

JeremyBernier commented 4 years ago

When attempting to run the sample code at the top of the README.md, this is the result:

/mnt/c/Users/jerem/Documents/code/test/lithtmlserver/node_modules/@popeindustries/lit-html-server/index.js:535
async function* resolveAsyncIteratorValue(iterator, part) {
              ^

SyntaxError: Unexpected token *
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/mnt/c/Users/jerem/Documents/code/test/lithtmlserver/index.js:1:80)

I think it'd be helpful to new users to resolve this, either by directing users to the steps they need to take to enable support for async generators, or if possible by compiling it down to ES5/ES6 so that they don't need an extra transpilation step.

popeindustries commented 4 years ago

Which version of Node are you running? Async iterators are supported in version 10 and up, and I’ve set the package.json#engines field appropriately. npm should give a warning, and yarn should fail, when trying to install the library on anything lower than 10. Now that version 12 is in LTS, I don’t think that’s an unreasonable minimum version.

JeremyBernier commented 4 years ago

Yea was on version 8 something, not sure why I didn't see a warning. Upgraded and fine now.