Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
react + rollup + typescript boilerplate

terminal:

npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx

package.json:

"scripts": {
  "build": "rollup -c",
  "watch": "rollup -cw"
}

rollup.config.js:

import typescript from 'rollup-plugin-typescript'

export default {
  entry: './src/index.tsx',
  dest: './dist/bundle.js',
  format: 'iife',
  plugins: [
    typescript()
  ]
}

tsconfig.json:

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "jsx": "react",
    "module": "es6",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "outDir": "./dist",
    "preserveConstEnums": true,
    "target": "es5"
  },
  "exclude": [
    "node_modules"
  ]
}
@rek
Copy link

rek commented Sep 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment