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"
]
}
What is the point of installing
typescript
? rollup uses the one that comes withrollup-plugin-typescript
which is 1.8.9 as of now.