adjusted build

This commit is contained in:
nedim hadzialic
2021-05-04 08:53:15 +02:00
parent e50831ea15
commit b6547f804d
3 changed files with 10 additions and 10 deletions

View File

@@ -93,7 +93,7 @@
"scripts": { "scripts": {
"prepare": "npm run build", "prepare": "npm run build",
"prebuild": "rimraf dist/ && rimraf build/ && mkdirp dist && mkdirp build", "prebuild": "rimraf dist/ && rimraf build/ && mkdirp dist && mkdirp build",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && npm run build:create-reftest-list && npm run build:testrunner && npm run build:minify", "build": "tsc --module commonjs && rollup -c rollup.config.ts && npm run build:create-reftest-list && npm run build:minify",
"build:testrunner": "rollup -c tests/rollup.config.ts", "build:testrunner": "rollup -c tests/rollup.config.ts",
"build:minify": "uglifyjs --compress --comments /^!/ -o dist/html2canvas.min.js --mangle -- dist/html2canvas.js", "build:minify": "uglifyjs --compress --comments /^!/ -o dist/html2canvas.min.js --mangle -- dist/html2canvas.js",
"build:reftest-result-list": "ts-node scripts/create-reftest-result-list.ts", "build:reftest-result-list": "ts-node scripts/create-reftest-result-list.ts",

View File

@@ -8,19 +8,19 @@ const pkg = require('./package.json');
const banner = `/*! const banner = `/*!
* ${pkg.title} ${pkg.version} <${pkg.homepage}> * ${pkg.title} ${pkg.version} <${pkg.homepage}>
* Copyright (c) ${(new Date()).getFullYear()} ${pkg.author.name} <${pkg.author.url}> * Copyright (c) ${new Date().getFullYear()} ${pkg.author.name} <${pkg.author.url}>
* Released under ${pkg.license} License * Released under ${pkg.license} License
*/`; */`;
export default { export default {
input: `src/index.ts`, input: `src/index.ts`,
output: [ output: [
{ file: pkg.main, name: pkg.name, format: 'umd', banner, sourcemap: true }, {file: pkg.main, name: pkg.name, format: 'umd', banner, sourcemap: true},
{ file: pkg.module, format: 'esm', banner, sourcemap: true }, {file: pkg.module, format: 'esm', banner, sourcemap: true}
], ],
external: [], external: [],
watch: { watch: {
include: 'src/**', include: 'src/**'
}, },
plugins: [ plugins: [
// Allow node_modules resolution, so you can use 'external' to control // Allow node_modules resolution, so you can use 'external' to control
@@ -30,13 +30,13 @@ export default {
// Allow json resolution // Allow json resolution
json(), json(),
// Compile TypeScript files // Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true }), typescript({useTsconfigDeclarationDir: true}),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs) // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs({ commonjs({
include: 'node_modules/**' include: 'node_modules/**'
}), }),
// Resolve source maps to the original source // Resolve source maps to the original source
sourceMaps(), sourceMaps()
], ]
} };

View File

@@ -291,5 +291,5 @@ const parse = (descriptor: CSSPropertyDescriptor<any>, style?: string | null) =>
} }
} }
throw new Error(`Attempting to parse unsupported css format type ${descriptor.format}`); throw new Error(`Attempting to parse unsupported css format type ${descriptor}`);
}; };