Skip to content

Commit cb7fbcf

Browse files
committed
Begin implementing rollup
1 parent 9a6e57a commit cb7fbcf

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"babel-eslint": "7.2.3",
2626
"babel-loader": "7.1.1",
2727
"babel-plugin-dev-expression": "0.2.1",
28+
"babel-plugin-external-helpers": "^6.22.0",
2829
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
2930
"babel-plugin-transform-object-rest-spread": "6.23.0",
3031
"babel-preset-es2015": "6.24.1",
@@ -56,6 +57,11 @@
5657
"promise-polyfill": "6.0.2",
5758
"replace-in-file": "^3.0.0",
5859
"rimraf": "2.6.1",
60+
"rollup": "0.57.1",
61+
"rollup-plugin-babel": "^3.0.3",
62+
"rollup-plugin-commonjs": "^9.1.0",
63+
"rollup-plugin-node-resolve": "^3.3.0",
64+
"rollup-plugin-uglify": "^3.0.0",
5965
"serve-index": "1.9.0",
6066
"slash": "1.0.0",
6167
"uglifyjs-webpack-plugin": "^1.1.2",
@@ -65,6 +71,7 @@
6571
"build": "rimraf dist/ && node scripts/create-reftest-list && npm run build:npm && npm run build:browser",
6672
"build:npm": "babel src/ -d dist/npm/ --plugins=dev-expression,transform-es2015-modules-commonjs && replace-in-file __VERSION__ '\"$npm_package_version\"' dist/npm/index.js",
6773
"build:browser": "webpack",
74+
"rollup": "rollup -c",
6875
"format": "prettier --single-quote --no-bracket-spacing --tab-width 4 --print-width 100 --write \"{src,www/src,tests,scripts}/**/*.js\"",
6976
"flow": "flow",
7077
"lint": "eslint src/**",

rollup.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* @flow */
2+
'use strict';
3+
4+
const fs = require('fs');
5+
const path = require('path');
6+
const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json')));
7+
8+
const banner =
9+
`/*
10+
${pkg.title} ${pkg.version} <${pkg.homepage}>
11+
Copyright (c) ${(new Date()).getFullYear()} ${pkg.author.name} <${pkg.author.url}>
12+
Released under ${pkg.license} License
13+
*/`;
14+
15+
import babel from 'rollup-plugin-babel';
16+
import commonjs from 'rollup-plugin-commonjs';
17+
import resolve from 'rollup-plugin-node-resolve';
18+
19+
export default {
20+
input: './src/index.js',
21+
plugins: [
22+
resolve(),
23+
babel({
24+
exclude: 'node_modules/**'
25+
}),
26+
commonjs({
27+
namedExports: {
28+
'node_modules/css-line-break/dist/index.js': ['toCodePoints', 'fromCodePoint', 'LineBreaker']
29+
}
30+
})
31+
],
32+
output: {
33+
file: './dist/html2canvas.js',
34+
name: 'html2canvas',
35+
format: 'umd',
36+
banner
37+
}
38+
};

0 commit comments

Comments
 (0)