kopiro / siriwave

The Apple® Siri wave-form replicated in a JS library.
http://kopiro.github.io/siriwave/
MIT License
1.63k stars 168 forks source link

Build TypeScript target version does not match Rollup output type #43

Closed semmel closed 4 years ago

semmel commented 4 years ago

Just nitpicking, but setting the TypeScript compile target to es5 and then bundling to an ES6 module with rollup does not make sense.

It may not hurt bad, except for readability and debugability for all who import dist/*.esm.js.

The options for the TypeScript rollup plugin permit setting the target dynamically overriding those in tsconfig.json.

E.g. plugins:[typescript({target: "es6"})]

Edit: I managed to quickly hack a proof of concept.

// just the edited lines in rollup.config.js
import typescript from "@rollup/plugin-typescript";
// ...
const plugins = [
  typescript({
    target: "es6",
    lib: ["es5", "es6", "ESNext", "dom"]
  }),
];

Unfortunately the upgraded TypeScript rollup plugin has a nasty bug which required some editing in tsconfig.json too:

{
  "compilerOptions": {
    "module": "es6",
    "noImplicitAny": true,
    "target": "es5",
    "moduleResolution": "node"
  },
  "include": ["src/*.ts"],
  "exclude": ["node_modules"]
}

It was also necessary for me to npm install tslib. Being not interested in TypeScript, I have not investigated further.

Btw.

  1. I did not find any license for siriwave. We're a very small company and would perhaps use it in one of our products.
  2. We really like your work, it's a really artistic visualisation.
kopiro commented 4 years ago

https://github.com/kopiro/siriwave/pull/47

Also added MIT license.