-1

I'm following this tutorial for creating an npm package. Here is my tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "module": "es2015",
        "sourceMap": true,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "declaration": true,
        "outDir": "./dist",
        "lib": ["es2015", "dom"]
    },
    "files": ["./lib/empty-text.ts"]
}

When I run rollup I get this error:

rollup-plugin-typescript: Unknown compiler option 'lib'.
[!] Error: rollup-plugin-typescript: Couldn't process compiler options
Error: rollup-plugin-typescript: Couldn't process compiler options
    at typescript (D:\sandbox\rollup-play\node_modules\rollup-plugin-typescript\dist\rollup-plugin-typescript.cjs.js:226:9)
    at Object.<anonymous> (D:\sandbox\rollup-play\rollup.config.umd.js:45:9)

When I remove lib from compilerOptions, I get a different set of errors. I'm using rollup v0.8.1. Does this version not support lib, if it does, what am I doing wrong?

Zeus82
  • 6,065
  • 9
  • 53
  • 77

1 Answers1

0

It is not rollup itself that is complaining, but the typescript compiler that is called by the typescript plugin for rollout that you are apparently using. The rollup-plugin-typescript comes with Typescript 1.8.9 per default. The "lib" compiler option, however, was introduced in TS 2.0. So try using a sufficiently up-to-date TS version. According to https://github.com/rollup/rollup-plugin-typescript#typescript-version you should do something like

typescript({
  typescript: require('some-fork-of-typescript')
})
Matthias
  • 1,759
  • 16
  • 34