简体   繁体   中英

Unable to get rollup working with an angular2 project

I am trying to get rollup setup with my ang2 project. I am unable to get past below error:-

D:\js\bundling\rollup_ng2_tes1\test1>D:\js\bundling\rollup_ng2_tes1\test1\node_modules\.bin\rollup -c
**?   typescript.readConfigFile is not a function**

Really wasted almost a day on this.

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}

rollup.config.js is as below.

import typescript from 'rollup-plugin-typescript';

export default 
{
  entry: './src/main.ts',

  plugins: [
    typescript({
       typescript: require('rollup-plugin-typescript')
    }) 
  ]
}

Any help, people???

You should use the latest typescript version for angular, and use this in the config. You are trying to use rollup-plugin-typescript as some kind of typescript fork, but it isn't :) :

let typescriptLatest = require('typescript')

export default {
  entry: './src/main.ts',

  plugins: [
    typescript({
       typescript: typescriptLatest
    }) 
  ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM