动机
以前写ts或者es6,都是用在脚手架搭建的项目中,比如vue和react,当时当我识图写一个ts的demo的,我还要创建一个完整的vue或者react项目?明显不合适,那就要研究一下如何手动搭建一套编译调试环境
源代码
src/index.ts
/*因为编译后的代码包含es6新增api,比如下边的includes,有浏览器可能不支持,故而需要引入垫片 这里可以选择core-js,也可以ts-polyfill,目的都是一样的*/ import 'core-js'; //具体目标 class Utils { protected cname:string = 'Utils'; public test(): void{ [1,2,3].includes(2) } } (window as any).subject = new Utils(); //方便页面使用
方案1:tsc编译+手动做垫片+webpack处理模块
使用tsc编译
tsconfig.json配置如下
{ "compilerOptions": { "target": "es5", /* 编译的目标是什么版本的 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs",/* 编译后模块化类型 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": [ //编译过程中需要引入的库文件的列表。 "es5", "es2016.array.include", "dom" //因为ts内用到了window ], "strict": true, "esModuleInterop": true } }
运行tsc命令后,编译后的代码src/index.js

"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // import 'core-js'; require("ts-polyfill/lib/es2016-array-include"); //具体目标 var Utils = /** @class */ (function () { function Utils() { this.cname = 'Utils'; } Utils.prototype.test = function () { [1, 2, 3].includes(2); }; return Utils; }()); window.subject = new Utils(); //方便页面使用
可以从代码中看到,tsc只是将ts代码编译js代码。有两个问题仍然需要我们处理,
他不管浏览器对编译后的js代码的兼容如何,所以我们需要手动做垫片,所以我们在入口文件src/index.ts处已经引入了coreJs做了垫片
然后他不处理模块化代码部分,比如import,export。目前node直接使用没问题,但是如果放在浏览器,2019年年底浏览器均不支持,所以需要webpack进行模块化处理。
我们将项目中安装webpack,并添加配置文件
npm install --save-dev webpack webpack-cli
const path = require('path'); module.exports = { mode: 'development', entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'main.js' } };
然后通过webpack命令webpack --mode development --progress来打包处理模块化,编译成功后的代码会很长,这里就不直接展开了。

/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./src/index.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/core-js/es/array/includes.js": /*!***************************************************!* !*** ./node_modules/core-js/es/array/includes.js ***! ***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("__webpack_require__(/*! ../../modules/es.array.includes */ "./node_modules/core-js/modules/es.array.includes.js"); var entryUnbind = __webpack_require__(/*! ../../internals/entry-unbind */ "./node_modules/core-js/internals/entry-unbind.js"); module.exports = entryUnbind('Array', 'includes'); //# sourceURL=webpack:///./node_modules/core-js/es/array/includes.js?"); /***/ }), /***/ "./node_modules/core-js/es/typed-array/includes.js": /*!*********************************************************!* !*** ./node_modules/core-js/es/typed-array/includes.js ***! *********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("__webpack_require__(/*! ../../modules/es.typed-array.includes */ "./node_modules/core-js/modules/es.typed-array.includes.js"); //# sourceURL=webpack:///./node_modules/core-js/es/typed-array/includes.js?"); /***/ }), /***/ "./node_modules/core-js/internals/a-function.js": /*!******************************************************!* !*** ./node_modules/core-js/internals/a-function.js ***! ******************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (it) { if (typeof it != 'function') { throw TypeError(String(it) + ' is not a function'); } return it; }; //# sourceURL=webpack:///./node_modules/core-js/internals/a-function.js?"); /***/ }), /***/ "./node_modules/core-js/internals/a-possible-prototype.js": /*!****************************************************************!* !*** ./node_modules/core-js/internals/a-possible-prototype.js ***! ****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); module.exports = function (it) { if (!isObject(it) && it !== null) { throw TypeError("Can't set " + String(it) + ' as a prototype'); } return it; }; //# sourceURL=webpack:///./node_modules/core-js/internals/a-possible-prototype.js?"); /***/ }), /***/ "./node_modules/core-js/internals/add-to-unscopables.js": /*!**************************************************************!* !*** ./node_modules/core-js/internals/add-to-unscopables.js ***! **************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js"); var create = __webpack_require__(/*! ../internals/object-create */ "./node_modules/core-js/internals/object-create.js"); var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js/internals/create-non-enumerable-property.js"); var UNSCOPABLES = wellKnownSymbol('unscopables'); var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype[UNSCOPABLES] == undefined) { createNonEnumerableProperty(ArrayPrototype, UNSCOPABLES, create(null)); } // add a key to Array.prototype[@@unscopables] module.exports = function (key) { ArrayPrototype[UNSCOPABLES][key] = true; }; //# sourceURL=webpack:///./node_modules/core-js/internals/add-to-unscopables.js?"); /***/ }), /***/ "./node_modules/core-js/internals/an-object.js": /*!*****************************************************!* !*** ./node_modules/core-js/internals/an-object.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); module.exports = function (it) { if (!isObject(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; //# sourceURL=webpack:///./node_modules/core-js/internals/an-object.js?"); /***/ }), /***/ "./node_modules/core-js/internals/array-buffer-view-core.js": /*!******************************************************************!* !*** ./node_modules/core-js/internals/array-buffer-view-core.js ***! ******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js"); var classof = __webpack_require__(/*! ../internals/classof */ "./node_modules/core-js/internals/classof.js"); var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js/internals/create-non-enumerable-property.js"); var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js"); var defineProperty = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js").f; var getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ "./node_modules/core-js/internals/object-get-prototype-of.js"); var setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ "./node_modules/core-js/internals/object-set-prototype-of.js"); var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js"); var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js"); var DataView = global.DataView; var DataViewPrototype = DataView && DataView.prototype; var Int8Array = global.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; var Uint8ClampedArray = global.Uint8ClampedArray; var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; var TypedArray = Int8Array && getPrototypeOf(Int8Array); var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); var ObjectPrototype = Object.prototype; var isPrototypeOf = ObjectPrototype.isPrototypeOf; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); var NATIVE_ARRAY_BUFFER = !!(global.ArrayBuffer && DataView); // Fixing native typed arrays in Opera Presto crashes the browser, see #595 var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera'; var TYPED_ARRAY_TAG_REQIRED = false; var NAME; var TypedArrayConstructorsList = { Int8Array: 1, Uint8Array: 1, Uint8ClampedArray: 1, Int16Array: 2, Uint16Array: 2, Int32Array: 4, Uint32Array: 4, Float32Array: 4, Float64Array: 8 }; var isView = function isView(it) { var klass = classof(it); return klass === 'DataView' || has(TypedArrayConstructorsList, klass); }; var isTypedArray = function (it) { return isObject(it) && has(TypedArrayConstructorsList, classof(it)); }; var aTypedArray = function (it) { if (isTypedArray(it)) return it; throw TypeError('Target is not a typed array'); }; var aTypedArrayConstructor = function (C) { if (setPrototypeOf) { if (isPrototypeOf.call(TypedArray, C)) return C; } else for (var ARRAY in TypedArrayConstructorsList) if (has(TypedArrayConstructorsList, NAME)) { var TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) { return C; } } throw TypeError('Target is not a typed array constructor'); }; var exportProto = function (KEY, property, forced) { if (!DESCRIPTORS) return; if (forced) for (var ARRAY in TypedArrayConstructorsList) { var TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) { delete TypedArrayConstructor.prototype[KEY]; } } if (!TypedArrayPrototype[KEY] || forced) { redefine(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property); } }; var exportStatic = function (KEY, property, forced) { var ARRAY, TypedArrayConstructor; if (!DESCRIPTORS) return; if (setPrototypeOf) { if (forced) for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) { delete TypedArrayConstructor[KEY]; } } if (!TypedArray[KEY] || forced) { // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable try { return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property); } catch (error) { /* empty */ } } else return; } for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { redefine(TypedArrayConstructor, KEY, property); } } }; for (NAME in TypedArrayConstructorsList) { if (!global[NAME]) NATIVE_ARRAY_BUFFER_VIEWS = false; } // WebKit bug - typed arrays constructors prototype is Object.prototype if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) { // eslint-disable-next-line no-shadow TypedArray = function TypedArray() { throw TypeError('Incorrect invocation'); }; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { if (global[NAME]) setPrototypeOf(global[NAME], TypedArray); } } if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) { TypedArrayPrototype = TypedArray.prototype; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype); } } // WebKit bug - one more object in Uint8ClampedArray prototype chain if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); } if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) { TYPED_ARRAY_TAG_REQIRED = true; defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () { return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; } }); for (NAME in TypedArrayConstructorsList) if (global[NAME]) { createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME); } } // WebKit bug - the same parent prototype for typed arrays and data view if (NATIVE_ARRAY_BUFFER && setPrototypeOf && getPrototypeOf(DataViewPrototype) !== ObjectPrototype) { setPrototypeOf(DataViewPrototype, ObjectPrototype); } module.exports = { NATIVE_ARRAY_BUFFER: NATIVE_ARRAY_BUFFER, NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, aTypedArray: aTypedArray, aTypedArrayConstructor: aTypedArrayConstructor, exportProto: exportProto, exportStatic: exportStatic, isView: isView, isTypedArray: isTypedArray, TypedArray: TypedArray, TypedArrayPrototype: TypedArrayPrototype }; //# sourceURL=webpack:///./node_modules/core-js/internals/array-buffer-view-core.js?"); /***/ }), /***/ "./node_modules/core-js/internals/array-includes.js": /*!**********************************************************!* !*** ./node_modules/core-js/internals/array-includes.js ***! **********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js"); var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js"); var toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ "./node_modules/core-js/internals/to-absolute-index.js"); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; module.exports = { // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; //# sourceURL=webpack:///./node_modules/core-js/internals/array-includes.js?"); /***/ }), /***/ "./node_modules/core-js/internals/bind-context.js": /*!********************************************************!* !*** ./node_modules/core-js/internals/bind-context.js ***! ********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var aFunction = __webpack_require__(/*! ../internals/a-function */ "./node_modules/core-js/internals/a-function.js"); // optional / simple context binding module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 0: return function () { return fn.call(that); }; case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; //# sourceURL=webpack:///./node_modules/core-js/internals/bind-context.js?"); /***/ }), /***/ "./node_modules/core-js/internals/classof-raw.js": /*!*******************************************************!* !*** ./node_modules/core-js/internals/classof-raw.js ***! *******************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; //# sourceURL=webpack:///./node_modules/core-js/internals/classof-raw.js?"); /***/ }), /***/ "./node_modules/core-js/internals/classof.js": /*!***************************************************!* !*** ./node_modules/core-js/internals/classof.js ***! ***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var classofRaw = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js"); var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js"); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` module.exports = function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; }; //# sourceURL=webpack:///./node_modules/core-js/internals/classof.js?"); /***/ }), /***/ "./node_modules/core-js/internals/copy-constructor-properties.js": /*!***********************************************************************!* !*** ./node_modules/core-js/internals/copy-constructor-properties.js ***! ***********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js"); var ownKeys = __webpack_require__(/*! ../internals/own-keys */ "./node_modules/core-js/internals/own-keys.js"); var getOwnPropertyDescriptorModule = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js"); var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js"); module.exports = function (target, source) { var keys = ownKeys(source); var defineProperty = definePropertyModule.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; //# sourceURL=webpack:///./node_modules/core-js/internals/copy-constructor-properties.js?"); /***/ }), /***/ "./node_modules/core-js/internals/correct-prototype-getter.js": /*!********************************************************************!* !*** ./node_modules/core-js/internals/correct-prototype-getter.js ***! ********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); module.exports = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; return Object.getPrototypeOf(new F()) !== F.prototype; }); //# sourceURL=webpack:///./node_modules/core-js/internals/correct-prototype-getter.js?"); /***/ }), /***/ "./node_modules/core-js/internals/create-non-enumerable-property.js": /*!**************************************************************************!* !*** ./node_modules/core-js/internals/create-non-enumerable-property.js ***! **************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js"); var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js"); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; //# sourceURL=webpack:///./node_modules/core-js/internals/create-non-enumerable-property.js?"); /***/ }), /***/ "./node_modules/core-js/internals/create-property-descriptor.js": /*!**********************************************************************!* !*** ./node_modules/core-js/internals/create-property-descriptor.js ***! **********************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; //# sourceURL=webpack:///./node_modules/core-js/internals/create-property-descriptor.js?"); /***/ }), /***/ "./node_modules/core-js/internals/descriptors.js": /*!*******************************************************!* !*** ./node_modules/core-js/internals/descriptors.js ***! *******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); // Thank's IE8 for his funny defineProperty module.exports = !fails(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); //# sourceURL=webpack:///./node_modules/core-js/internals/descriptors.js?"); /***/ }), /***/ "./node_modules/core-js/internals/document-create-element.js": /*!*******************************************************************!* !*** ./node_modules/core-js/internals/document-create-element.js ***! *******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; //# sourceURL=webpack:///./node_modules/core-js/internals/document-create-element.js?"); /***/ }), /***/ "./node_modules/core-js/internals/entry-unbind.js": /*!********************************************************!* !*** ./node_modules/core-js/internals/entry-unbind.js ***! ********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var bind = __webpack_require__(/*! ../internals/bind-context */ "./node_modules/core-js/internals/bind-context.js"); var call = Function.call; module.exports = function (CONSTRUCTOR, METHOD, length) { return bind(call, global[CONSTRUCTOR].prototype[METHOD], length); }; //# sourceURL=webpack:///./node_modules/core-js/internals/entry-unbind.js?"); /***/ }), /***/ "./node_modules/core-js/internals/enum-bug-keys.js": /*!*********************************************************!* !*** ./node_modules/core-js/internals/enum-bug-keys.js ***! *********************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("// IE8- don't enum bug keys module.exports = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; //# sourceURL=webpack:///./node_modules/core-js/internals/enum-bug-keys.js?"); /***/ }), /***/ "./node_modules/core-js/internals/export.js": /*!**************************************************!* !*** ./node_modules/core-js/internals/export.js ***! **************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var getOwnPropertyDescriptor = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js").f; var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js/internals/create-non-enumerable-property.js"); var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js"); var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js"); var copyConstructorProperties = __webpack_require__(/*! ../internals/copy-constructor-properties */ "./node_modules/core-js/internals/copy-constructor-properties.js"); var isForced = __webpack_require__(/*! ../internals/is-forced */ "./node_modules/core-js/internals/is-forced.js"); /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global; } else if (STATIC) { target = global[TARGET] || setGlobal(TARGET, {}); } else { target = (global[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty === typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } // extend global redefine(target, key, sourceProperty, options); } }; //# sourceURL=webpack:///./node_modules/core-js/internals/export.js?"); /***/ }), /***/ "./node_modules/core-js/internals/fails.js": /*!*************************************************!* !*** ./node_modules/core-js/internals/fails.js ***! *************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; //# sourceURL=webpack:///./node_modules/core-js/internals/fails.js?"); /***/ }), /***/ "./node_modules/core-js/internals/function-to-string.js": /*!**************************************************************!* !*** ./node_modules/core-js/internals/function-to-string.js ***! **************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js"); module.exports = shared('native-function-to-string', Function.toString); //# sourceURL=webpack:///./node_modules/core-js/internals/function-to-string.js?"); /***/ }), /***/ "./node_modules/core-js/internals/get-built-in.js": /*!********************************************************!* !*** ./node_modules/core-js/internals/get-built-in.js ***! ********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var path = __webpack_require__(/*! ../internals/path */ "./node_modules/core-js/internals/path.js"); var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var aFunction = function (variable) { return typeof variable == 'function' ? variable : undefined; }; module.exports = function (namespace, method) { return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; }; //# sourceURL=webpack:///./node_modules/core-js/internals/get-built-in.js?"); /***/ }), /***/ "./node_modules/core-js/internals/global.js": /*!**************************************************!* !*** ./node_modules/core-js/internals/global.js ***! **************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line no-undef check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func Function('return this')(); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) //# sourceURL=webpack:///./node_modules/core-js/internals/global.js?"); /***/ }), /***/ "./node_modules/core-js/internals/has.js": /*!***********************************************!* !*** ./node_modules/core-js/internals/has.js ***! ***********************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; //# sourceURL=webpack:///./node_modules/core-js/internals/has.js?"); /***/ }), /***/ "./node_modules/core-js/internals/hidden-keys.js": /*!*******************************************************!* !*** ./node_modules/core-js/internals/hidden-keys.js ***! *******************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = {}; //# sourceURL=webpack:///./node_modules/core-js/internals/hidden-keys.js?"); /***/ }), /***/ "./node_modules/core-js/internals/html.js": /*!************************************************!* !*** ./node_modules/core-js/internals/html.js ***! ************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ "./node_modules/core-js/internals/get-built-in.js"); module.exports = getBuiltIn('document', 'documentElement'); //# sourceURL=webpack:///./node_modules/core-js/internals/html.js?"); /***/ }), /***/ "./node_modules/core-js/internals/ie8-dom-define.js": /*!**********************************************************!* !*** ./node_modules/core-js/internals/ie8-dom-define.js ***! **********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); var createElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js"); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); //# sourceURL=webpack:///./node_modules/core-js/internals/ie8-dom-define.js?"); /***/ }), /***/ "./node_modules/core-js/internals/indexed-object.js": /*!**********************************************************!* !*** ./node_modules/core-js/internals/indexed-object.js ***! **********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); var classof = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js"); var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins return !Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof(it) == 'String' ? split.call(it, '') : Object(it); } : Object; //# sourceURL=webpack:///./node_modules/core-js/internals/indexed-object.js?"); /***/ }), /***/ "./node_modules/core-js/internals/internal-state.js": /*!**********************************************************!* !*** ./node_modules/core-js/internals/internal-state.js ***! **********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/native-weak-map */ "./node_modules/core-js/internals/native-weak-map.js"); var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js/internals/create-non-enumerable-property.js"); var objectHas = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js"); var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js"); var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js"); var WeakMap = global.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP) { var store = new WeakMap(); var wmget = store.get; var wmhas = store.has; var wmset = store.set; set = function (it, metadata) { wmset.call(store, it, metadata); return metadata; }; get = function (it) { return wmget.call(store, it) || {}; }; has = function (it) { return wmhas.call(store, it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return objectHas(it, STATE) ? it[STATE] : {}; }; has = function (it) { return objectHas(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; //# sourceURL=webpack:///./node_modules/core-js/internals/internal-state.js?"); /***/ }), /***/ "./node_modules/core-js/internals/is-forced.js": /*!*****************************************************!* !*** ./node_modules/core-js/internals/is-forced.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; //# sourceURL=webpack:///./node_modules/core-js/internals/is-forced.js?"); /***/ }), /***/ "./node_modules/core-js/internals/is-object.js": /*!*****************************************************!* !*** ./node_modules/core-js/internals/is-object.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; //# sourceURL=webpack:///./node_modules/core-js/internals/is-object.js?"); /***/ }), /***/ "./node_modules/core-js/internals/is-pure.js": /*!***************************************************!* !*** ./node_modules/core-js/internals/is-pure.js ***! ***************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = false; //# sourceURL=webpack:///./node_modules/core-js/internals/is-pure.js?"); /***/ }), /***/ "./node_modules/core-js/internals/native-symbol.js": /*!*********************************************************!* !*** ./node_modules/core-js/internals/native-symbol.js ***! *********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); module.exports = !!Object.getOwnPropertySymbols && !fails(function () { // Chrome 38 Symbol has incorrect toString conversion // eslint-disable-next-line no-undef return !String(Symbol()); }); //# sourceURL=webpack:///./node_modules/core-js/internals/native-symbol.js?"); /***/ }), /***/ "./node_modules/core-js/internals/native-weak-map.js": /*!***********************************************************!* !*** ./node_modules/core-js/internals/native-weak-map.js ***! ***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js"); var WeakMap = global.WeakMap; module.exports = typeof WeakMap === 'function' && /native code/.test(nativeFunctionToString.call(WeakMap)); //# sourceURL=webpack:///./node_modules/core-js/internals/native-weak-map.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-create.js": /*!*********************************************************!* !*** ./node_modules/core-js/internals/object-create.js ***! *********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js"); var defineProperties = __webpack_require__(/*! ../internals/object-define-properties */ "./node_modules/core-js/internals/object-define-properties.js"); var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js"); var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js"); var html = __webpack_require__(/*! ../internals/html */ "./node_modules/core-js/internals/html.js"); var documentCreateElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js"); var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js"); var IE_PROTO = sharedKey('IE_PROTO'); var PROTOTYPE = 'prototype'; var Empty = function () { /* empty */ }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var length = enumBugKeys.length; var lt = '<'; var script = 'script'; var gt = '>'; var js = 'java' + script + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); iframe.src = String(js); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt); iframeDocument.close(); createDict = iframeDocument.F; while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]]; return createDict(); }; // `Object.create` method // https://tc39.github.io/ecma262/#sec-object.create module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE] = anObject(O); result = new Empty(); Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : defineProperties(result, Properties); }; hiddenKeys[IE_PROTO] = true; //# sourceURL=webpack:///./node_modules/core-js/internals/object-create.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-define-properties.js": /*!********************************************************************!* !*** ./node_modules/core-js/internals/object-define-properties.js ***! ********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js"); var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js"); var objectKeys = __webpack_require__(/*! ../internals/object-keys */ "./node_modules/core-js/internals/object-keys.js"); // `Object.defineProperties` method // https://tc39.github.io/ecma262/#sec-object.defineproperties module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]); return O; }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-define-properties.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-define-property.js": /*!******************************************************************!* !*** ./node_modules/core-js/internals/object-define-property.js ***! ******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js"); var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js"); var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js"); var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.github.io/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return nativeDefineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-define-property.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-get-own-property-descriptor.js": /*!******************************************************************************!* !*** ./node_modules/core-js/internals/object-get-own-property-descriptor.js ***! ******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var propertyIsEnumerableModule = __webpack_require__(/*! ../internals/object-property-is-enumerable */ "./node_modules/core-js/internals/object-property-is-enumerable.js"); var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js"); var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js"); var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js"); var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js"); var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js"); var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return nativeGetOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-get-own-property-descriptor.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-get-own-property-names.js": /*!*************************************************************************!* !*** ./node_modules/core-js/internals/object-get-own-property-names.js ***! *************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js"); var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js"); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.github.io/ecma262/#sec-object.getownpropertynames exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-get-own-property-names.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-get-own-property-symbols.js": /*!***************************************************************************!* !*** ./node_modules/core-js/internals/object-get-own-property-symbols.js ***! ***************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("exports.f = Object.getOwnPropertySymbols; //# sourceURL=webpack:///./node_modules/core-js/internals/object-get-own-property-symbols.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-get-prototype-of.js": /*!*******************************************************************!* !*** ./node_modules/core-js/internals/object-get-prototype-of.js ***! *******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js"); var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js"); var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js"); var CORRECT_PROTOTYPE_GETTER = __webpack_require__(/*! ../internals/correct-prototype-getter */ "./node_modules/core-js/internals/correct-prototype-getter.js"); var IE_PROTO = sharedKey('IE_PROTO'); var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.getprototypeof module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { O = toObject(O); if (has(O, IE_PROTO)) return O[IE_PROTO]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectPrototype : null; }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-get-prototype-of.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-keys-internal.js": /*!****************************************************************!* !*** ./node_modules/core-js/internals/object-keys-internal.js ***! ****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js"); var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js"); var indexOf = __webpack_require__(/*! ../internals/array-includes */ "./node_modules/core-js/internals/array-includes.js").indexOf; var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js"); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has(O, key = names[i++])) { ~indexOf(result, key) || result.push(key); } return result; }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-keys-internal.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-keys.js": /*!*******************************************************!* !*** ./node_modules/core-js/internals/object-keys.js ***! *******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js"); var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js"); // `Object.keys` method // https://tc39.github.io/ecma262/#sec-object.keys module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-keys.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-property-is-enumerable.js": /*!*************************************************************************!* !*** ./node_modules/core-js/internals/object-property-is-enumerable.js ***! *************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" var nativePropertyIsEnumerable = {}.propertyIsEnumerable; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : nativePropertyIsEnumerable; //# sourceURL=webpack:///./node_modules/core-js/internals/object-property-is-enumerable.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-set-prototype-of.js": /*!*******************************************************************!* !*** ./node_modules/core-js/internals/object-set-prototype-of.js ***! *******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js"); var aPossiblePrototype = __webpack_require__(/*! ../internals/a-possible-prototype */ "./node_modules/core-js/internals/a-possible-prototype.js"); // `Object.setPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; setter.call(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { anObject(O); aPossiblePrototype(proto); if (CORRECT_SETTER) setter.call(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); //# sourceURL=webpack:///./node_modules/core-js/internals/object-set-prototype-of.js?"); /***/ }), /***/ "./node_modules/core-js/internals/own-keys.js": /*!****************************************************!* !*** ./node_modules/core-js/internals/own-keys.js ***! ****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ "./node_modules/core-js/internals/get-built-in.js"); var getOwnPropertyNamesModule = __webpack_require__(/*! ../internals/object-get-own-property-names */ "./node_modules/core-js/internals/object-get-own-property-names.js"); var getOwnPropertySymbolsModule = __webpack_require__(/*! ../internals/object-get-own-property-symbols */ "./node_modules/core-js/internals/object-get-own-property-symbols.js"); var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js"); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; //# sourceURL=webpack:///./node_modules/core-js/internals/own-keys.js?"); /***/ }), /***/ "./node_modules/core-js/internals/path.js": /*!************************************************!* !*** ./node_modules/core-js/internals/path.js ***! ************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("module.exports = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); //# sourceURL=webpack:///./node_modules/core-js/internals/path.js?"); /***/ }), /***/ "./node_modules/core-js/internals/redefine.js": /*!****************************************************!* !*** ./node_modules/core-js/internals/redefine.js ***! ****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js"); var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js/internals/create-non-enumerable-property.js"); var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js"); var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js"); var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js"); var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js"); var getInternalState = InternalStateModule.get; var enforceInternalState = InternalStateModule.enforce; var TEMPLATE = String(nativeFunctionToString).split('toString'); shared('inspectSource', function (it) { return nativeFunctionToString.call(it); }); (module.exports = function (O, key, value, options) { var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; if (typeof value == 'function') { if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key); enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); } if (O === global) { if (simple) O[key] = value; else setGlobal(key, value); return; } else if (!unsafe) { delete O[key]; } else if (!noTargetGet && O[key]) { simple = true; } if (simple) O[key] = value; else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, 'toString', function toString() { return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this); }); //# sourceURL=webpack:///./node_modules/core-js/internals/redefine.js?"); /***/ }), /***/ "./node_modules/core-js/internals/require-object-coercible.js": /*!********************************************************************!* !*** ./node_modules/core-js/internals/require-object-coercible.js ***! ********************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("// `RequireObjectCoercible` abstract operation // https://tc39.github.io/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; //# sourceURL=webpack:///./node_modules/core-js/internals/require-object-coercible.js?"); /***/ }), /***/ "./node_modules/core-js/internals/set-global.js": /*!******************************************************!* !*** ./node_modules/core-js/internals/set-global.js ***! ******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js/internals/create-non-enumerable-property.js"); module.exports = function (key, value) { try { createNonEnumerableProperty(global, key, value); } catch (error) { global[key] = value; } return value; }; //# sourceURL=webpack:///./node_modules/core-js/internals/set-global.js?"); /***/ }), /***/ "./node_modules/core-js/internals/shared-key.js": /*!******************************************************!* !*** ./node_modules/core-js/internals/shared-key.js ***! ******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js"); var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js"); var keys = shared('keys'); module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; //# sourceURL=webpack:///./node_modules/core-js/internals/shared-key.js?"); /***/ }), /***/ "./node_modules/core-js/internals/shared-store.js": /*!********************************************************!* !*** ./node_modules/core-js/internals/shared-store.js ***! ********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js"); var SHARED = '__core-js_shared__'; var store = global[SHARED] || setGlobal(SHARED, {}); module.exports = store; //# sourceURL=webpack:///./node_modules/core-js/internals/shared-store.js?"); /***/ }), /***/ "./node_modules/core-js/internals/shared.js": /*!**************************************************!* !*** ./node_modules/core-js/internals/shared.js ***! **************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js"); var store = __webpack_require__(/*! ../internals/shared-store */ "./node_modules/core-js/internals/shared-store.js"); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.3.5', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2019 Denis Pushkarev (zloirock.ru)' }); //# sourceURL=webpack:///./node_modules/core-js/internals/shared.js?"); /***/ }), /***/ "./node_modules/core-js/internals/to-absolute-index.js": /*!*************************************************************!* !*** ./node_modules/core-js/internals/to-absolute-index.js ***! *************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js"); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length). module.exports = function (index, length) { var integer = toInteger(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; //# sourceURL=webpack:///./node_modules/core-js/internals/to-absolute-index.js?"); /***/ }), /***/ "./node_modules/core-js/internals/to-indexed-object.js": /*!*************************************************************!* !*** ./node_modules/core-js/internals/to-indexed-object.js ***! *************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// toObject with fallback for non-array-like ES3 strings var IndexedObject = __webpack_require__(/*! ../internals/indexed-object */ "./node_modules/core-js/internals/indexed-object.js"); var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js"); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; //# sourceURL=webpack:///./node_modules/core-js/internals/to-indexed-object.js?"); /***/ }), /***/ "./node_modules/core-js/internals/to-integer.js": /*!******************************************************!* !*** ./node_modules/core-js/internals/to-integer.js ***! ******************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var ceil = Math.ceil; var floor = Math.floor; // `ToInteger` abstract operation // https://tc39.github.io/ecma262/#sec-tointeger module.exports = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; //# sourceURL=webpack:///./node_modules/core-js/internals/to-integer.js?"); /***/ }), /***/ "./node_modules/core-js/internals/to-length.js": /*!*****************************************************!* !*** ./node_modules/core-js/internals/to-length.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js"); var min = Math.min; // `ToLength` abstract operation // https://tc39.github.io/ecma262/#sec-tolength module.exports = function (argument) { return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; //# sourceURL=webpack:///./node_modules/core-js/internals/to-length.js?"); /***/ }), /***/ "./node_modules/core-js/internals/to-object.js": /*!*****************************************************!* !*** ./node_modules/core-js/internals/to-object.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js"); // `ToObject` abstract operation // https://tc39.github.io/ecma262/#sec-toobject module.exports = function (argument) { return Object(requireObjectCoercible(argument)); }; //# sourceURL=webpack:///./node_modules/core-js/internals/to-object.js?"); /***/ }), /***/ "./node_modules/core-js/internals/to-primitive.js": /*!********************************************************!* !*** ./node_modules/core-js/internals/to-primitive.js ***! ********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); // `ToPrimitive` abstract operation // https://tc39.github.io/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (input, PREFERRED_STRING) { if (!isObject(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; //# sourceURL=webpack:///./node_modules/core-js/internals/to-primitive.js?"); /***/ }), /***/ "./node_modules/core-js/internals/uid.js": /*!***********************************************!* !*** ./node_modules/core-js/internals/uid.js ***! ***********************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var id = 0; var postfix = Math.random(); module.exports = function (key) { return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); }; //# sourceURL=webpack:///./node_modules/core-js/internals/uid.js?"); /***/ }), /***/ "./node_modules/core-js/internals/well-known-symbol.js": /*!*************************************************************!* !*** ./node_modules/core-js/internals/well-known-symbol.js ***! *************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js"); var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js"); var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/native-symbol */ "./node_modules/core-js/internals/native-symbol.js"); var Symbol = global.Symbol; var store = shared('wks'); module.exports = function (name) { return store[name] || (store[name] = NATIVE_SYMBOL && Symbol[name] || (NATIVE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; //# sourceURL=webpack:///./node_modules/core-js/internals/well-known-symbol.js?"); /***/ }), /***/ "./node_modules/core-js/modules/es.array.includes.js": /*!***********************************************************!* !*** ./node_modules/core-js/modules/es.array.includes.js ***! ***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js"); var $includes = __webpack_require__(/*! ../internals/array-includes */ "./node_modules/core-js/internals/array-includes.js").includes; var addToUnscopables = __webpack_require__(/*! ../internals/add-to-unscopables */ "./node_modules/core-js/internals/add-to-unscopables.js"); // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes $({ target: 'Array', proto: true }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); //# sourceURL=webpack:///./node_modules/core-js/modules/es.array.includes.js?"); /***/ }), /***/ "./node_modules/core-js/modules/es.typed-array.includes.js": /*!*****************************************************************!* !*** ./node_modules/core-js/modules/es.typed-array.includes.js ***! *****************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" var ArrayBufferViewCore = __webpack_require__(/*! ../internals/array-buffer-view-core */ "./node_modules/core-js/internals/array-buffer-view-core.js"); var $includes = __webpack_require__(/*! ../internals/array-includes */ "./node_modules/core-js/internals/array-includes.js").includes; var aTypedArray = ArrayBufferViewCore.aTypedArray; // `%TypedArray%.prototype.includes` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.includes ArrayBufferViewCore.exportProto('includes', function includes(searchElement /* , fromIndex */) { return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); //# sourceURL=webpack:///./node_modules/core-js/modules/es.typed-array.includes.js?"); /***/ }), /***/ "./node_modules/ts-polyfill/lib/es2016-array-include.js": /*!**************************************************************!* !*** ./node_modules/ts-polyfill/lib/es2016-array-include.js ***! **************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" Object.defineProperty(exports, "__esModule", { value: true }); __webpack_require__(/*! core-js/es/array/includes */ "./node_modules/core-js/es/array/includes.js"); __webpack_require__(/*! core-js/es/typed-array/includes */ "./node_modules/core-js/es/typed-array/includes.js"); //# sourceURL=webpack:///./node_modules/ts-polyfill/lib/es2016-array-include.js?"); /***/ }), /***/ "./node_modules/webpack/buildin/global.js": /*!***********************************!* !*** (webpack)/buildin/global.js ***! ***********************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; //# sourceURL=webpack:///(webpack)/buildin/global.js?"); /***/ }), /***/ "./src/index.js": /*!**********************!* !*** ./src/index.js ***! **********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" Object.defineProperty(exports, "__esModule", { value: true }); // import 'core-js'; __webpack_require__(/*! ts-polyfill/lib/es2016-array-include */ "./node_modules/ts-polyfill/lib/es2016-array-include.js"); //具体目标 var Utils = /** @class */ (function () { function Utils() { this.cname = 'Utils'; } Utils.prototype.test = function () { [1, 2, 3].includes(2); }; return Utils; }()); window.subject = new Utils(); //方便页面使用 //# sourceURL=webpack:///./src/index.js?"); /***/ }) /******/ });
将编译后的文件直接通过script的方式引入页面,就可以使用了
<body> <script src="./dist/main.js"></script> </body>
缺点:垫片要手动处理,不智能。用到了两个工具
方案二:ts编译+babel接手垫片+webpack模块化
我们源代码需要改动一下,删除头部引入coreJs,我们不需要手动做垫片
//具体目标 class Utils { protected cname:string = 'Utils'; public test(): void{ [1,2,3].includes(2) } } (window as any).subject = new Utils(); //方便页面使用
仍旧是ts编译,可以看到编译后src/index.js的代码,明显也少了引入垫片corejs这行代码
"use strict"; //具体目标 var Utils = /** @class */ (function () { function Utils() { this.cname = 'Utils'; } Utils.prototype.test = function () { [1, 2, 3].includes(2); }; return Utils; }()); window.subject = new Utils(); //方便页面使用
安装babel,让babel处理垫片。创建babel配置文件babel.config.js
装babel的时候让我惊讶的是,不用安装@babel/polyfill也能(babel)编译和(webpack)模块打包成功,分析了下原因:
1、编译阶段是不需要垫片的,因为此时编译后的文件只是多出来了垫片的引用,是否找得到编译器它不考虑
2、垫片的使用时发生在用webpack打包阶段,因为他要处理垫片生成的import,import的内容就是垫片库@babel/polyfill里的文件,如果你没有安装此包webpack处理的时候找不到会报错
3、至于我为啥后边webpack成功了,是因为我刚才误多装了core-js包,而这个包恰恰就是我需要的垫片包,
因为我的babel是7.4以上,@babel/polyfill已经被废弃了被分解成了core-js、regenerator-runtime两个包,刚好歪打正着。所以我们可以提前安装上这两个包,不然webpack打包阶段会报错
const presets = [ [ "@babel/env", { useBuiltIns: "usage" //自动按需引入对应的垫片 }, ], ]; module.exports = { presets };
执行babel打包命令npx babel src/index.js --out-dir src,打包后的src/index.js有看到babel已经帮我们处理好了垫片环境
"use strict"; //具体目标 require("core-js/modules/es7.array.includes"); require("core-js/modules/es6.string.includes"); var Utils = /** @class */ function () { function Utils() { this.cname = 'Utils'; } Utils.prototype.test = function () { [1, 2, 3].includes(2); }; return Utils; }(); window.subject = new Utils(); //方便页面使用
然后我们再用webpack处理模块化webpack --mode development --progress。然后他妈的就报错了
ERROR in ./src/index.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.includes' in '/Users/dsh/Documents/demo/tsceg/src'
@ ./src/index.js 5:0-46
ERROR in ./src/index.js
Module not found: Error: Can't resolve 'core-js/modules/es7.array.includes' in '/Users/dsh/Documents/demo/tsceg/src'
@ ./src/index.js 3:0-45
我仔细的瞅了瞅node-module下边的core-js包,发现包里的moduels下就没有es6.string.includes和es7.array.includes这两个文件。我跑到github下找到这货的项目,看了看v3确实没有,但是v2还有,那看来就是第一种方案的时候,手动装垫片的时候,coreJs的版本默认给我装到v3。简言之,版本装错了,重新改成v2后就好了,一下是打包后的文件,就不展开了

/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./src/index.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/core-js/modules/_a-function.js": /*!*****************************************************!* !*** ./node_modules/core-js/modules/_a-function.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_a-function.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_add-to-unscopables.js": /*!*************************************************************!* !*** ./node_modules/core-js/modules/_add-to-unscopables.js ***! *************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('unscopables'); var ArrayProto = Array.prototype; if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js")(ArrayProto, UNSCOPABLES, {}); module.exports = function (key) { ArrayProto[UNSCOPABLES][key] = true; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_add-to-unscopables.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_an-object.js": /*!****************************************************!* !*** ./node_modules/core-js/modules/_an-object.js ***! ****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_an-object.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_array-includes.js": /*!*********************************************************!* !*** ./node_modules/core-js/modules/_array-includes.js ***! *********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js"); var toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js"); var toAbsoluteIndex = __webpack_require__(/*! ./_to-absolute-index */ "./node_modules/core-js/modules/_to-absolute-index.js"); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) if (IS_INCLUDES || index in O) { if (O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_array-includes.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_cof.js": /*!**********************************************!* !*** ./node_modules/core-js/modules/_cof.js ***! **********************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_cof.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_core.js": /*!***********************************************!* !*** ./node_modules/core-js/modules/_core.js ***! ***********************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var core = module.exports = { version: '2.6.10' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef //# sourceURL=webpack:///./node_modules/core-js/modules/_core.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_ctx.js": /*!**********************************************!* !*** ./node_modules/core-js/modules/_ctx.js ***! **********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// optional / simple context binding var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js"); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_ctx.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_defined.js": /*!**************************************************!* !*** ./node_modules/core-js/modules/_defined.js ***! **************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("// 7.2.1 RequireObjectCoercible(argument) module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_defined.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_descriptors.js": /*!******************************************************!* !*** ./node_modules/core-js/modules/_descriptors.js ***! ******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); //# sourceURL=webpack:///./node_modules/core-js/modules/_descriptors.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_dom-create.js": /*!*****************************************************!* !*** ./node_modules/core-js/modules/_dom-create.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); var document = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_dom-create.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_export.js": /*!*************************************************!* !*** ./node_modules/core-js/modules/_export.js ***! *************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); var core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js"); var hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js"); var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js"); var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js"); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); var key, own, out, exp; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if (target) redefine(target, key, out, type & $export.U); // export if (exports[key] != out) hide(exports, key, exp); if (IS_PROTO && expProto[key] != out) expProto[key] = out; } }; global.core = core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; //# sourceURL=webpack:///./node_modules/core-js/modules/_export.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_fails-is-regexp.js": /*!**********************************************************!* !*** ./node_modules/core-js/modules/_fails-is-regexp.js ***! **********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var MATCH = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('match'); module.exports = function (KEY) { var re = /./; try { '/./'[KEY](re); } catch (e) { try { re[MATCH] = false; return !'/./'[KEY](re); } catch (f) { /* empty */ } } return true; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_fails-is-regexp.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_fails.js": /*!************************************************!* !*** ./node_modules/core-js/modules/_fails.js ***! ************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; //# sourceURL=webpack:///./node_modules/core-js/modules/_fails.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_function-to-string.js": /*!*************************************************************!* !*** ./node_modules/core-js/modules/_function-to-string.js ***! *************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("module.exports = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('native-function-to-string', Function.toString); //# sourceURL=webpack:///./node_modules/core-js/modules/_function-to-string.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_global.js": /*!*************************************************!* !*** ./node_modules/core-js/modules/_global.js ***! *************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef //# sourceURL=webpack:///./node_modules/core-js/modules/_global.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_has.js": /*!**********************************************!* !*** ./node_modules/core-js/modules/_has.js ***! **********************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_has.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_hide.js": /*!***********************************************!* !*** ./node_modules/core-js/modules/_hide.js ***! ***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js"); var createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js"); module.exports = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_hide.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_ie8-dom-define.js": /*!*********************************************************!* !*** ./node_modules/core-js/modules/_ie8-dom-define.js ***! *********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("module.exports = !__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") && !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () { return Object.defineProperty(__webpack_require__(/*! ./_dom-create */ "./node_modules/core-js/modules/_dom-create.js")('div'), 'a', { get: function () { return 7; } }).a != 7; }); //# sourceURL=webpack:///./node_modules/core-js/modules/_ie8-dom-define.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_iobject.js": /*!**************************************************!* !*** ./node_modules/core-js/modules/_iobject.js ***! **************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js"); // eslint-disable-next-line no-prototype-builtins module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_iobject.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_is-object.js": /*!****************************************************!* !*** ./node_modules/core-js/modules/_is-object.js ***! ****************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_is-object.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_is-regexp.js": /*!****************************************************!* !*** ./node_modules/core-js/modules/_is-regexp.js ***! ****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// 7.2.8 IsRegExp(argument) var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js"); var MATCH = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('match'); module.exports = function (it) { var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_is-regexp.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_library.js": /*!**************************************************!* !*** ./node_modules/core-js/modules/_library.js ***! **************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = false; //# sourceURL=webpack:///./node_modules/core-js/modules/_library.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_object-dp.js": /*!****************************************************!* !*** ./node_modules/core-js/modules/_object-dp.js ***! ****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); var IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ "./node_modules/core-js/modules/_ie8-dom-define.js"); var toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js"); var dP = Object.defineProperty; exports.f = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_object-dp.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_property-desc.js": /*!********************************************************!* !*** ./node_modules/core-js/modules/_property-desc.js ***! ********************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; //# sourceURL=webpack:///./node_modules/core-js/modules/_property-desc.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_redefine.js": /*!***************************************************!* !*** ./node_modules/core-js/modules/_redefine.js ***! ***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); var hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js"); var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); var SRC = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js")('src'); var $toString = __webpack_require__(/*! ./_function-to-string */ "./node_modules/core-js/modules/_function-to-string.js"); var TO_STRING = 'toString'; var TPL = ('' + $toString).split(TO_STRING); __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js").inspectSource = function (it) { return $toString.call(it); }; (module.exports = function (O, key, val, safe) { var isFunction = typeof val == 'function'; if (isFunction) has(val, 'name') || hide(val, 'name', key); if (O[key] === val) return; if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if (O === global) { O[key] = val; } else if (!safe) { delete O[key]; hide(O, key, val); } else if (O[key]) { O[key] = val; } else { hide(O, key, val); } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString() { return typeof this == 'function' && this[SRC] || $toString.call(this); }); //# sourceURL=webpack:///./node_modules/core-js/modules/_redefine.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_shared.js": /*!*************************************************!* !*** ./node_modules/core-js/modules/_shared.js ***! *************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js"); var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); var SHARED = '__core-js_shared__'; var store = global[SHARED] || (global[SHARED] = {}); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: core.version, mode: __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js") ? 'pure' : 'global', copyright: '© 2019 Denis Pushkarev (zloirock.ru)' }); //# sourceURL=webpack:///./node_modules/core-js/modules/_shared.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_string-context.js": /*!*********************************************************!* !*** ./node_modules/core-js/modules/_string-context.js ***! *********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// helper for String#{startsWith, endsWith, includes} var isRegExp = __webpack_require__(/*! ./_is-regexp */ "./node_modules/core-js/modules/_is-regexp.js"); var defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js"); module.exports = function (that, searchString, NAME) { if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(defined(that)); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_string-context.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_to-absolute-index.js": /*!************************************************************!* !*** ./node_modules/core-js/modules/_to-absolute-index.js ***! ************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js"); var max = Math.max; var min = Math.min; module.exports = function (index, length) { index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_to-absolute-index.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_to-integer.js": /*!*****************************************************!* !*** ./node_modules/core-js/modules/_to-integer.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("// 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; module.exports = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_to-integer.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_to-iobject.js": /*!*****************************************************!* !*** ./node_modules/core-js/modules/_to-iobject.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js"); var defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js"); module.exports = function (it) { return IObject(defined(it)); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_to-iobject.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_to-length.js": /*!****************************************************!* !*** ./node_modules/core-js/modules/_to-length.js ***! ****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// 7.1.15 ToLength var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js"); var min = Math.min; module.exports = function (it) { return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; //# sourceURL=webpack:///./node_modules/core-js/modules/_to-length.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_to-primitive.js": /*!*******************************************************!* !*** ./node_modules/core-js/modules/_to-primitive.js ***! *******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("// 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (it, S) { if (!isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_to-primitive.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_uid.js": /*!**********************************************!* !*** ./node_modules/core-js/modules/_uid.js ***! **********************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var id = 0; var px = Math.random(); module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; //# sourceURL=webpack:///./node_modules/core-js/modules/_uid.js?"); /***/ }), /***/ "./node_modules/core-js/modules/_wks.js": /*!**********************************************!* !*** ./node_modules/core-js/modules/_wks.js ***! **********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var store = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('wks'); var uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js"); var Symbol = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; //# sourceURL=webpack:///./node_modules/core-js/modules/_wks.js?"); /***/ }), /***/ "./node_modules/core-js/modules/es6.string.includes.js": /*!*************************************************************!* !*** ./node_modules/core-js/modules/es6.string.includes.js ***! *************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("// 21.1.3.7 String.prototype.includes(searchString, position = 0) var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js"); var context = __webpack_require__(/*! ./_string-context */ "./node_modules/core-js/modules/_string-context.js"); var INCLUDES = 'includes'; $export($export.P + $export.F * __webpack_require__(/*! ./_fails-is-regexp */ "./node_modules/core-js/modules/_fails-is-regexp.js")(INCLUDES), 'String', { includes: function includes(searchString /* , position = 0 */) { return !!~context(this, searchString, INCLUDES) .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); } }); //# sourceURL=webpack:///./node_modules/core-js/modules/es6.string.includes.js?"); /***/ }), /***/ "./node_modules/core-js/modules/es7.array.includes.js": /*!************************************************************!* !*** ./node_modules/core-js/modules/es7.array.includes.js ***! ************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" // https://github.com/tc39/Array.prototype.includes var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js"); var $includes = __webpack_require__(/*! ./_array-includes */ "./node_modules/core-js/modules/_array-includes.js")(true); $export($export.P, 'Array', { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(/*! ./_add-to-unscopables */ "./node_modules/core-js/modules/_add-to-unscopables.js")('includes'); //# sourceURL=webpack:///./node_modules/core-js/modules/es7.array.includes.js?"); /***/ }), /***/ "./src/index.js": /*!**********************!* !*** ./src/index.js ***! **********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval(" //具体目标 __webpack_require__(/*! core-js/modules/es7.array.includes */ "./node_modules/core-js/modules/es7.array.includes.js"); __webpack_require__(/*! core-js/modules/es6.string.includes */ "./node_modules/core-js/modules/es6.string.includes.js"); var Utils = /** @class */ function () { function Utils() { this.cname = 'Utils'; } Utils.prototype.test = function () { [1, 2, 3].includes(2); }; return Utils; }(); window.subject = new Utils(); //方便页面使用 //# sourceURL=webpack:///./src/index.js?"); /***/ }) /******/ });
缺点:虽然编译成了老版本的js和做了垫片,但是却多用了一个工具babel,现在是一工3个工具
方案三:只用webpack(ts-loader + babel-loader)
webpack的优秀之处在于,他能以loader和plugin的方式将其他工具整个到自身内。那么我们分别用ts-loader和babel-loader来仅用webpack去处理ts。避免了使用过多的工具的问题。
新建一个项目,
初始化node配置文件自动生成packge.json。
安装webpack,并新增配置文件。
新增入口文件src/index.ts
测试页面引入编译后的dist/main.js文件,别的内容没有
目录解构如下:
1、安装ts-loader,主要分4部分
npm install ts-loader typescript --save-dev
安装ts-loader
安装typescript
新增tsconfig.json,配置文件内容如上(当然也可以像下边babel配置文件的方式一样,只是懒得重复演示)
配置webpack对ts的loader规则,具体文件下边一起放出
2、安装babel-loader
其实这个时候,执行webpack就可以将ts编译为js了,但是为了兼容老的浏览器,我们要用babel来做垫片
安装babel核心库和babel-loader以及babel欲设
npm install -D babel-loader @babel/core @babel/preset-env
另外就是垫片包了,babel7.4以上,@babel/polylill已经被启用了,代替他的是core-js、regenerator-runtime这两个包,记得安装
npm install -D core-js regenerator-runtime
然后把babel的配置转移到webpack的配置文件里就行,无需额外的配置文件
const path = require('path'); module.exports = { mode: 'development', entry: ['./src/index.ts'], output: { path: path.resolve(__dirname, 'dist'), filename: 'main.js' }, module: { rules: [ { test: /.ts$/,use: [ { loader: 'babel-loader', options: { presets: [ [ '@babel/preset-env', { "useBuiltIns": "usage", "corejs": 3, "targets": {"browsers":["> 1%"]}, } ] ], // 我是真搞不懂这厮,编译现在不用它也不会报错,同学们视情况而定吧,报错用 // 我认为可能是ts-loader已经给处理了类的实例属性,所以交付给babel-loader的时候,就不会有解析不过的问题了 // plugins:[ // ["@babel/plugin-proposal-class-properties", { "loose": true }] // ] } }, {loader: 'ts-loader'} ]} ] } };
这里有详细的关于匹配多个loader的用法
3、然后直接用webpack进行编译就行了
npx webpack --config webpack.config.js
优点在于一口气配置完后,只需要一个命令行就编译打包完。
对了提一下配置,如果用了ts-loader和babel-loader,
在tsconfig的配置中,尽量不要处理模块化,编译的语法也不要设置成比较低的es版本。因为后续babel会做。这是哪个老外告诉我的
esnext是指es最新的标准,ts是es基础上加了类型,target esnext基本就等于是ts只做类型检查,然后去掉类型标注得到es代码
缺点:虽然只用了一个工具,但是却用了两个loader,ts-loader和babel-loader,需要两个工具的安装 引入和配置
方案四:只用webpack(里边只用babel-loader)
现在新版的babel可以直接处理ts文件了,那么相应的的babel-loader也能处理。所以我们都可以省去一步,或者省掉一个loader,只用增加配置babel-loader就搞定
要想让babel-loader支持ts解析,那么需要安装一个插件@babel/preset-typescript,然后在修改配置文件webpack.config.js如下
const path = require('path'); module.exports = { mode: 'development', entry: ['./src/index.ts'], output: { path: path.resolve(__dirname, 'dist'), filename: 'main.js' }, module: { rules: [ { test: /.js$|.ts$/, loader: "babel-loader",exclude: /node_modules/, options: { presets: [ [ '@babel/preset-env', { "useBuiltIns": "usage", "corejs": 3, "targets": {"browsers":["> 1%"]}, } ], ["@babel/preset-typescript"] ], plugins:[ ["@babel/plugin-proposal-class-properties", { "loose": true }] ] } } ] } };
因为我的代码里,有类实例属性定义,目前es6还不支持在类里定义属性,只能定义方法(妈的,刚才试了下,chrome78居然支持了),但估计支持没几年吧
而且@babel/preset-typescript也尚未支持对此的处理(如果用了ts-loader的话,它就给处理了,所以这也是方案三 为啥没装这个插件也可以编译的原因了)
所以编译的时候需要安装一个额外的插件去处理此类语法,@babel/plugin-proposal-class-properties,并加入到如上的配置文件的plugins里。
我好奇,如果是js我定义了类的实例属性,会不会也需要这个插件,果然需要。
所以这个就是用来专门处理js或ts等类的实例属性编译机制的,所以单独拉出来做了个插件。
如果在preset-env和preset-typescript集合里内置了这个插件就好了,我觉得很常用啊,不然还得自己单独去加到plugins里
完事之后在webpack编译。就大工告成啦

/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/core-js/internals/an-object.js": /*!*****************************************************!* !*** ./node_modules/core-js/internals/an-object.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); module.exports = function (it) { if (!isObject(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; //# sourceURL=webpack:///./node_modules/core-js/internals/an-object.js?"); /***/ }), /***/ "./node_modules/core-js/internals/descriptors.js": /*!*******************************************************!* !*** ./node_modules/core-js/internals/descriptors.js ***! *******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); // Thank's IE8 for his funny defineProperty module.exports = !fails(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); //# sourceURL=webpack:///./node_modules/core-js/internals/descriptors.js?"); /***/ }), /***/ "./node_modules/core-js/internals/document-create-element.js": /*!*******************************************************************!* !*** ./node_modules/core-js/internals/document-create-element.js ***! *******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js"); var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; //# sourceURL=webpack:///./node_modules/core-js/internals/document-create-element.js?"); /***/ }), /***/ "./node_modules/core-js/internals/fails.js": /*!*************************************************!* !*** ./node_modules/core-js/internals/fails.js ***! *************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; //# sourceURL=webpack:///./node_modules/core-js/internals/fails.js?"); /***/ }), /***/ "./node_modules/core-js/internals/global.js": /*!**************************************************!* !*** ./node_modules/core-js/internals/global.js ***! **************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line no-undef check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func Function('return this')(); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) //# sourceURL=webpack:///./node_modules/core-js/internals/global.js?"); /***/ }), /***/ "./node_modules/core-js/internals/ie8-dom-define.js": /*!**********************************************************!* !*** ./node_modules/core-js/internals/ie8-dom-define.js ***! **********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js"); var createElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js"); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); //# sourceURL=webpack:///./node_modules/core-js/internals/ie8-dom-define.js?"); /***/ }), /***/ "./node_modules/core-js/internals/is-object.js": /*!*****************************************************!* !*** ./node_modules/core-js/internals/is-object.js ***! *****************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; //# sourceURL=webpack:///./node_modules/core-js/internals/is-object.js?"); /***/ }), /***/ "./node_modules/core-js/internals/object-define-property.js": /*!******************************************************************!* !*** ./node_modules/core-js/internals/object-define-property.js ***! ******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js"); var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js"); var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js"); var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.github.io/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return nativeDefineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; //# sourceURL=webpack:///./node_modules/core-js/internals/object-define-property.js?"); /***/ }), /***/ "./node_modules/core-js/internals/to-primitive.js": /*!********************************************************!* !*** ./node_modules/core-js/internals/to-primitive.js ***! ********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js"); // `ToPrimitive` abstract operation // https://tc39.github.io/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (input, PREFERRED_STRING) { if (!isObject(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; //# sourceURL=webpack:///./node_modules/core-js/internals/to-primitive.js?"); /***/ }), /***/ "./node_modules/core-js/modules/es.function.name.js": /*!**********************************************************!* !*** ./node_modules/core-js/modules/es.function.name.js ***! **********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js"); var defineProperty = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js").f; var FunctionPrototype = Function.prototype; var FunctionPrototypeToString = FunctionPrototype.toString; var nameRE = /^\s*function ([^ (]*)/; var NAME = 'name'; // Function instances `.name` property // https://tc39.github.io/ecma262/#sec-function-instances-name if (DESCRIPTORS && !(NAME in FunctionPrototype)) { defineProperty(FunctionPrototype, NAME, { configurable: true, get: function () { try { return FunctionPrototypeToString.call(this).match(nameRE)[1]; } catch (error) { return ''; } } }); } //# sourceURL=webpack:///./node_modules/core-js/modules/es.function.name.js?"); /***/ }), /***/ "./node_modules/webpack/buildin/global.js": /*!***********************************!* !*** (webpack)/buildin/global.js ***! ***********************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; //# sourceURL=webpack:///(webpack)/buildin/global.js?"); /***/ }), /***/ "./src/index.js": /*!**********************!* !*** ./src/index.js ***! **********************/ /*! no exports provided */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; eval("__webpack_require__.r(__webpack_exports__); /* harmony import */ var core_js_modules_es_function_name__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.function.name */ "./node_modules/core-js/modules/es.function.name.js"); /* harmony import */ var core_js_modules_es_function_name__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name__WEBPACK_IMPORTED_MODULE_0__); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var A = /*#__PURE__*/ function () { function A() { _classCallCheck(this, A); } _createClass(A, null, [{ key: "getName", value: function getName() {} }]); return A; }(); A.name = 123; //# sourceURL=webpack:///./src/index.js?"); /***/ }), /***/ 0: /*!****************************!* !*** multi ./src/index.js ***! ****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("module.exports = __webpack_require__(/*! ./src/index.js */"./src/index.js"); //# sourceURL=webpack:///multi_./src/index.js?"); /***/ }) /******/ });
这是我的所有包,仅供参考
{ "name": "wpeg", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC", "devDependencies": { "@babel/core": "^7.6.4", "@babel/plugin-proposal-class-properties": "^7.5.5", "@babel/preset-env": "^7.6.3", "@babel/preset-typescript": "^7.6.0", "babel-loader": "^8.0.6", "core-js": "^3.3.5", "regenerator-runtime": "^0.13.3", "webpack": "^4.41.2", "webpack-cli": "^3.3.9" }, "dependencies": {} }
通过配置文件分析可知,webpack已经不需要ts-loader了,而作为ts-loader的依赖包typescript也自然不需要了,作为ts的配置文件tsconfig.json也可以删除了。这样就省去了大量的ts第三方包和配置
缺点:需要较高版本的babel,但是这个问题会随着时间迎刃而解
babelCli直接编译ts
刚才有提到,babel7可以直接处理ts了,下边就讲一下单独使用babel工具的话,使用步骤?
新建一个空项目,创建src/index.ts后,除了安装如上必须的babel工具之外,还要做如下处理
a:首先要安装一个预设:npm install @babel/preset-typescript -D
b:如果你的类里边就像我的代码一样有类的实例属性,那么还要安装一个支持该特性的插件:
npm install @babel/plugin-proposal-class-properties -D
c:然后创建babel的配置文件babel.config.js

然后运行npx babel src/index.ts --out-dir dist即可
所以最后的结论就是,用一个工具webpack,加一个处理器babel-loader就完全可以搞定ts啦