├── .npmrc ├── .gitignore ├── webpack.config.js ├── dist ├── index.d.ts ├── index.min.js └── index.js ├── package.json ├── LICENSE ├── example └── index.html ├── lib └── index.ts ├── README.md └── tsconfig.json /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org/ 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | *.zip 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | # Editor directories and files 8 | .idea 9 | .vscode 10 | *.suo 11 | *.ntvs* 12 | *.njsproj 13 | *.sln 14 | package-lock.json 15 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const uglify = require('uglifyjs-webpack-plugin'); 2 | module.exports = { 3 | entry: './dist/index.js', 4 | output: { 5 | filename: '../dist/index.min.js', 6 | libraryTarget: "umd", 7 | library: "imgZip", 8 | libraryExport: "default", 9 | umdNamedDefine: true, 10 | }, 11 | optimization: { 12 | minimizer: [ 13 | new uglify({ 14 | uglifyOptions: { 15 | compress: false 16 | } 17 | }) 18 | ] 19 | }, 20 | }; -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | interface compressOptions { 2 | height?: number; 3 | width?: number; 4 | quality?: number; 5 | } 6 | declare class Imgzip { 7 | private options; 8 | constructor(options?: compressOptions); 9 | /** 10 | * @param path 文件路径 11 | * @param callback 图片压缩后执行的回调函数 12 | */ 13 | canvasDataURL(path: string, callback: Function): void; 14 | /** 15 | * @param file 文件对象 16 | * @param callback 17 | */ 18 | photoCompress(file: Blob, callback: Function): void; 19 | /** 20 | * base64转blod流 21 | * @param urlData 22 | * @returns {Blob} 23 | */ 24 | static convertBase64UrlToBlob(urlData: string): Blob | undefined; 25 | } 26 | export default Imgzip; 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "imgzip", 3 | "version": "2.0.10", 4 | "description": "compress img", 5 | "main": "dist/index.min.js", 6 | "types": "dist/index.d.ts", 7 | "scripts": { 8 | "build": "webpack --mode production", 9 | "tsc": "tsc", 10 | "tsc & build": "tsc && npm run build" 11 | }, 12 | "keywords": [ 13 | "compress", 14 | "img", 15 | "zip" 16 | ], 17 | "files": [ 18 | "dist" 19 | ], 20 | "author": "mgso", 21 | "license": "MIT", 22 | "devDependencies": { 23 | "typescript": "^4.0.3", 24 | "uglifyjs-webpack-plugin": "^1.2.7", 25 | "webpack-cli": "^3.3.12", 26 | "@babel/core": "^7.11.6", 27 | "@babel/plugin-transform-modules-commonjs": "^7.10.4", 28 | "@babel/preset-env": "^7.11.5", 29 | "babel-core": "^6.26.3", 30 | "babel-loader": "^8.1.0", 31 | "babel-preset-es2015": "^6.24.1", 32 | "webpack": "^4.16.0" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/mgsod/imgZip/issues" 36 | }, 37 | "repository": { 38 | "type": "git", 39 | "url": "https://github.com/mgsod/imgZip" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-present mgso 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dist/index.min.js: -------------------------------------------------------------------------------- 1 | (function e(t,r){if(typeof exports==="object"&&typeof module==="object")module.exports=r();else if(typeof define==="function"&&define.amd)define("imgZip",[],r);else if(typeof exports==="object")exports["imgZip"]=r();else t["imgZip"]=r()})(window,function(){return function(e){var t={};function r(n){if(t[n]){return t[n].exports}var o=t[n]={i:n,l:false,exports:{}};e[n].call(o.exports,o,o.exports,r);o.l=true;return o.exports}r.m=e;r.c=t;r.d=function(e,t,n){if(!r.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:n})}};r.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})};r.t=function(e,t){if(t&1)e=r(e);if(t&8)return e;if(t&4&&typeof e==="object"&&e&&e.__esModule)return e;var n=Object.create(null);r.r(n);Object.defineProperty(n,"default",{enumerable:true,value:e});if(t&2&&typeof e!="string")for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n};r.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};r.d(t,"a",t);return t};r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};r.p="";return r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=function(){function e(e){if(e){var t=e.quality,r=t===void 0?.7:t,n=e.width,o=e.height;this.options={quality:r,width:n,height:o}}else{this.options={quality:.7}}}e.prototype.canvasDataURL=function(e,t){var r=this;var n=new Image;n.src=e;n.onload=function(e){var n=e.target;var o=n.width,i=n.height,a=o/i;o=r.options.width||o;i=r.options.height||o/a;var u=document.createElement("canvas");var f=u.getContext("2d");var l=document.createAttribute("width");l.nodeValue=o.toString();var c=document.createAttribute("height");c.nodeValue=i.toString();u.setAttributeNode(l);u.setAttributeNode(c);f===null||f===void 0?void 0:f.drawImage(n,0,0,o,i);var d=u.toDataURL("image/jpeg",r.options.quality);t&&t(d)}};e.prototype.photoCompress=function(e,t){var r=this;var n=new FileReader;n.readAsDataURL(e);n.onload=function(e){var n=e.target;var o=n.result;r.canvasDataURL(o,t)}};e.convertBase64UrlToBlob=function(e){var t=e.split(",");var r=t[0].match(/:(.*?);/);if(!r)return;var n=r[1];var o=atob(t[1]),i=o.length,a=new Uint8Array(i);while(i--){a[i]=o.charCodeAt(i)}return new Blob([a],{type:n})};return e}();t.default=n}])["default"]}); -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 47 | 48 | 49 | 50 |
51 |
52 | 53 | 54 | 55 | 56 |
57 |
58 |
59 |

before

60 | 63 |
64 |
65 |

after

66 | 69 |
70 | 71 |
72 | 73 |
74 | 75 | 76 | 103 | 104 | -------------------------------------------------------------------------------- /lib/index.ts: -------------------------------------------------------------------------------- 1 | interface compressOptions { 2 | height?: number; 3 | width?: number; 4 | quality?: number; 5 | } 6 | class Imgzip { 7 | private options: compressOptions; 8 | constructor(options?: compressOptions) { 9 | if (options) { 10 | let {quality = 0.7, width, height} = options; 11 | this.options = { 12 | quality: quality, 13 | width: width, 14 | height: height 15 | } 16 | } else { 17 | this.options = { 18 | quality: 0.7 19 | } 20 | } 21 | } 22 | 23 | /** 24 | * @param path 文件路径 25 | * @param callback 图片压缩后执行的回调函数 26 | */ 27 | canvasDataURL(path: string, callback: Function) { 28 | let img = new Image(); 29 | img.src = path; 30 | img.onload = (e) => { 31 | let that = e.target; 32 | // 默认按比例压缩 33 | let w: number = that.width, 34 | h: number = that.height, 35 | scale = w as number / h; 36 | w = this.options.width || w; 37 | h = this.options.height || (w / scale); //默认等比压缩 38 | //生成canvas 39 | let canvas = document.createElement('canvas'); 40 | let ctx = canvas.getContext('2d'); 41 | // 创建属性节点 42 | let anw: Attr = document.createAttribute("width"); 43 | anw.nodeValue = w.toString(); 44 | let anh: Attr = document.createAttribute("height"); 45 | anh.nodeValue = h.toString(); 46 | canvas.setAttributeNode(anw); 47 | canvas.setAttributeNode(anh); 48 | ctx?.drawImage(that, 0, 0, w, h); 49 | // quality值越小,所绘制出的图像越模糊 50 | let base64 = canvas.toDataURL('image/jpeg', this.options.quality); 51 | // 回调函数返回base64的值 52 | callback && callback(base64); 53 | } 54 | } 55 | 56 | /** 57 | * @param file 文件对象 58 | * @param callback 59 | */ 60 | photoCompress(file: Blob, callback: Function) { 61 | let ready = new FileReader(); 62 | //开始读取指定的Blob对象或File对象中的内容. 63 | //当读取操作完成时,readyState属性的值会成为DONE 64 | // 如果设置了onloadend事件处理程序,则调用之. 65 | //同时,result属性中将包含一个data: URL格式的字符串以表示所读取文件的内容. 66 | ready.readAsDataURL(file); 67 | ready.onload = (event) => { 68 | let imgFile = event.target; 69 | let path = imgFile.result; 70 | this.canvasDataURL(path, callback) 71 | } 72 | } 73 | 74 | /** 75 | * base64转blod流 76 | * @param urlData 77 | * @returns {Blob} 78 | */ 79 | static convertBase64UrlToBlob(urlData: string): Blob | undefined { 80 | let arr = urlData.split(','); 81 | let mime = arr[0].match(/:(.*?);/); 82 | if (!mime) return; 83 | let type = mime[1]; 84 | let bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); 85 | while (n--) { 86 | u8arr[n] = bstr.charCodeAt(n); 87 | } 88 | return new Blob([u8arr], {type}); 89 | } 90 | } 91 | 92 | export default Imgzip 93 | 94 | 95 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var Imgzip = /** @class */ (function () { 4 | function Imgzip(options) { 5 | if (options) { 6 | var _a = options.quality, quality = _a === void 0 ? 0.7 : _a, width = options.width, height = options.height; 7 | this.options = { 8 | quality: quality, 9 | width: width, 10 | height: height 11 | }; 12 | } 13 | else { 14 | this.options = { 15 | quality: 0.7 16 | }; 17 | } 18 | } 19 | /** 20 | * @param path 文件路径 21 | * @param callback 图片压缩后执行的回调函数 22 | */ 23 | Imgzip.prototype.canvasDataURL = function (path, callback) { 24 | var _this = this; 25 | var img = new Image(); 26 | img.src = path; 27 | img.onload = function (e) { 28 | var that = e.target; 29 | // 默认按比例压缩 30 | var w = that.width, h = that.height, scale = w / h; 31 | w = _this.options.width || w; 32 | h = _this.options.height || (w / scale); //默认等比压缩 33 | //生成canvas 34 | var canvas = document.createElement('canvas'); 35 | var ctx = canvas.getContext('2d'); 36 | // 创建属性节点 37 | var anw = document.createAttribute("width"); 38 | anw.nodeValue = w.toString(); 39 | var anh = document.createAttribute("height"); 40 | anh.nodeValue = h.toString(); 41 | canvas.setAttributeNode(anw); 42 | canvas.setAttributeNode(anh); 43 | ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(that, 0, 0, w, h); 44 | // quality值越小,所绘制出的图像越模糊 45 | var base64 = canvas.toDataURL('image/jpeg', _this.options.quality); 46 | // 回调函数返回base64的值 47 | callback && callback(base64); 48 | }; 49 | }; 50 | /** 51 | * @param file 文件对象 52 | * @param callback 53 | */ 54 | Imgzip.prototype.photoCompress = function (file, callback) { 55 | var _this = this; 56 | var ready = new FileReader(); 57 | //开始读取指定的Blob对象或File对象中的内容. 58 | //当读取操作完成时,readyState属性的值会成为DONE 59 | // 如果设置了onloadend事件处理程序,则调用之. 60 | //同时,result属性中将包含一个data: URL格式的字符串以表示所读取文件的内容. 61 | ready.readAsDataURL(file); 62 | ready.onload = function (event) { 63 | var imgFile = event.target; 64 | var path = imgFile.result; 65 | _this.canvasDataURL(path, callback); 66 | }; 67 | }; 68 | /** 69 | * base64转blod流 70 | * @param urlData 71 | * @returns {Blob} 72 | */ 73 | Imgzip.convertBase64UrlToBlob = function (urlData) { 74 | var arr = urlData.split(','); 75 | var mime = arr[0].match(/:(.*?);/); 76 | if (!mime) 77 | return; 78 | var type = mime[1]; 79 | var bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); 80 | while (n--) { 81 | u8arr[n] = bstr.charCodeAt(n); 82 | } 83 | return new Blob([u8arr], { type: type }); 84 | }; 85 | return Imgzip; 86 | }()); 87 | exports.default = Imgzip; 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # imgZip 2 | 图片压缩插件 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ### Demo示例 12 | 13 | [图片压缩](https://unpkg.com/imgzip@2.0.8/example/index.html) 14 | 15 | ### 安装 16 | 17 | #### npm 18 | ``` 19 | npm i imgzip 20 | ``` 21 | 22 | #### script 23 | ```` 24 | 25 | ```` 26 | `@2.0.8`为固定版本,可自行调整 27 | 28 | ### 使用方法 29 | 30 | #### 2.x版本(支持ts) 31 | 32 | ```javascript 33 | import imgzip from "imgzip"; 34 | 35 | export default { 36 | name: "App", 37 | mounted() { 38 | // 监听选择文件 39 | document.getElementById("file").onchange = function () { 40 | // @2.x版本后采用 class Api。所以需要 new 一个 imgZip 对象 41 | let compress = new imgzip({ quality: 0.5 }); 42 | // 调用图片压缩 43 | compress.photoCompress(this.files[0], function (base64) { 44 | // document.getElementById('img').src = base64 //预览图片 45 | // 转 blob 流上传 convertBase64UrlToBlob函数为 imgzip 的静态函数 46 | let blob = imgzip.convertBase64UrlToBlob(base64); 47 | let formData = new FormData(); 48 | formData.append("file", blob, "file_" + Date.parse(new Date()) + ".jpg"); // 文件对象 49 | // 上传操作.... 50 | }); 51 | }; 52 | }, 53 | }; 54 | ``` 55 | ### 函数说明 56 | 57 | > @2.x版本后改用class api, 原`photoCompress`函数中传入的`options`参数改为实例化imgzip时传入。 58 | 59 | * new imgZip(options) 60 | 61 | | 参数 | 说明 | 是否必须 | 默认值 | 62 | | ------ | ------ | ------ | ------ | 63 | | options.width | 图片宽度 | 否 | 图片原始宽度 | 64 | | options.height | 图片高度 | 否 | 图片原始高度 | 65 | | options.quality | 图片质量 | 否 | 0.7 | 66 | 67 | 68 | 69 | * photoCompress(图片压缩函数) 无返回值 70 | 71 | | 参数 | 说明 | 是否必须 | 默认值 | 72 | | ------ | ------ | ------ | ------ | 73 | | file | 文件对象(Blod) | 是 | - || 74 | | callback | 压缩后回调函数,回调参数返回压缩后的base64编码 | 是 | - | 75 | 76 | 77 | 78 | 79 | 80 | #### 1.x版本(不支持ts) 81 | 82 | ```javascript 83 | import imgzip from "imgzip"; 84 | 85 | export default { 86 | name: "App", 87 | mounted() { 88 | // 监听选择文件 89 | document.getElementById("file").onchange = function () { 90 | // 调用图片压缩 91 | imgzip.photoCompress(this.files[0], {}, function (base64) { 92 | // document.getElementById('img').src = base64 //预览图片 93 | // 转 blob 流上传 94 | let blob = imgzip.convertBase64UrlToBlob(base64); 95 | let formData = new FormData(); 96 | formData.append("file", blob, "file_" + Date.parse(new Date()) + ".jpg"); // 文件对象 97 | // 上传操作.... 98 | }); 99 | }; 100 | }, 101 | }; 102 | ``` 103 | ### 函数说明 104 | * photoCompress(图片压缩函数) 105 | 106 | | 参数 | 说明 | 是否必须 | 默认值 | 107 | | ------ | ------ | ------ | ------ | 108 | | file | 文件对象(Blod) | 是 | - | 109 | | options | 压缩参数(宽/高/质量)| 否 | {width:图片高度,height:图片宽高比,quality:0.7}| 110 | | callback | 压缩后回调函数,回调参数返回压缩后的base64编码 | 是 | - | 111 | 112 | 113 | 114 | 115 | * convertBase64UrlToBlob(base64编码转blod流) 1.x版本和2.x版本均为`imgzip`的静态函数 116 | 117 | | 参数 | 说明 | 是否必须 | 默认值 | 返回值 | 118 | | ------ | ------ | ------ | ------ | ------ | 119 | | base64 | 图片base64编码 | 是 | - | Blod | 120 | 121 | 122 | ## 致谢 123 | 感谢[JetBrains](https://www.jetbrains.com)提供的开源License 124 | 125 | ![JetBrains Logo (Main) logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg) 126 | 127 | [https://jb.gg/OpenSourceSupport](https://jb.gg/OpenSourceSupport) 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | "declaration": true, 5 | "outDir": "./dist", 6 | /* Basic Options */ 7 | // "incremental": true, /* Enable incremental compilation */ 8 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 9 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 10 | // "lib": [], /* Specify library files to be included in the compilation. */ 11 | // "allowJs": true, /* Allow javascript files to be compiled. */ 12 | // "checkJs": true, /* Report errors in .js files. */ 13 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 14 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 15 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 16 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 17 | // "outFile": "./", /* Concatenate and emit output to single file. */ 18 | // "outDir": "./", /* Redirect output structure to the directory. */ 19 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 20 | // "composite": true, /* Enable project compilation */ 21 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 22 | // "removeComments": true, /* Do not emit comments to output. */ 23 | // "noEmit": true, /* Do not emit outputs. */ 24 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 25 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 26 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 27 | 28 | /* Strict Type-Checking Options */ 29 | "strict": true, /* Enable all strict type-checking options. */ 30 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 31 | // "strictNullChecks": true, /* Enable strict null checks. */ 32 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 33 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 34 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 35 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 36 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 37 | 38 | /* Additional Checks */ 39 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 40 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 41 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 42 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 43 | 44 | /* Module Resolution Options */ 45 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 46 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 47 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 48 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 49 | // "typeRoots": [], /* List of folders to include type definitions from. */ 50 | // "types": [], /* Type declaration files to be included in compilation. */ 51 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 52 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 53 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 54 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 55 | 56 | /* Source Map Options */ 57 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 58 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 59 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 60 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 61 | 62 | /* Experimental Options */ 63 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 64 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 65 | 66 | /* Advanced Options */ 67 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 68 | "forceConsistentCasingInFileNames": true, 69 | /* Disallow inconsistently-cased references to the same file. */ 70 | "lib": [ 71 | "dom", 72 | "es5", 73 | "scripthost", 74 | "dom" 75 | ] 76 | } 77 | } 78 | --------------------------------------------------------------------------------