From 81ba8278d128b5b44fa2218e8fd6e966bc77a827 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 13:19:04 -0400 Subject: [PATCH 1/8] Fix module from tsconfig.json --- src/index.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/index.js b/src/index.js index 47763590..5fa354be 100644 --- a/src/index.js +++ b/src/index.js @@ -335,14 +335,10 @@ function ncc ( compiler: eval('__dirname + "/typescript.js"'), compilerOptions: { allowSyntheticDefaultImports: true, - module: 'esnext', - outDir: '//', - ...(fullTsconfig && - fullTsconfig.compilerOptions && - fullTsconfig.compilerOptions.incremental - ? { incremental: false } - : {}), - noEmit: false + incremental: fullTsconfig?.compilerOptions?.incremental ?? false, + module: fullTsconfig?.compilerOptions?.module ?? 'esnext', + noEmit: false, + outDir: '//' } } }] From bb1e0e604079884dd89215c3957d5085414f7da9 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 13:32:37 -0400 Subject: [PATCH 2/8] Pass all `compilerOptions` --- src/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 5fa354be..47ee900d 100644 --- a/src/index.js +++ b/src/index.js @@ -109,7 +109,7 @@ function ncc ( // add TsconfigPathsPlugin to support `paths` resolution in tsconfig // we need to catch here because the plugin will // error if there's no tsconfig in the working directory - let fullTsconfig; + let fullTsconfig = {}; try { const tsconfig = tsconfigPaths.loadConfig(); fullTsconfig = loadTsconfig(tsconfig.configFileAbsolutePath) || { @@ -334,9 +334,8 @@ function ncc ( transpileOnly, compiler: eval('__dirname + "/typescript.js"'), compilerOptions: { + ...fullTsconfig.compilerOptions, allowSyntheticDefaultImports: true, - incremental: fullTsconfig?.compilerOptions?.incremental ?? false, - module: fullTsconfig?.compilerOptions?.module ?? 'esnext', noEmit: false, outDir: '//' } From 29bbcacde7b566f065ca2f389f472d938845367d Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 13:35:05 -0400 Subject: [PATCH 3/8] Add default `esnext` Co-authored-by: Guy Bedford --- src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.js b/src/index.js index 47ee900d..d7bd6c8e 100644 --- a/src/index.js +++ b/src/index.js @@ -334,6 +334,7 @@ function ncc ( transpileOnly, compiler: eval('__dirname + "/typescript.js"'), compilerOptions: { + module: 'esnext' ...fullTsconfig.compilerOptions, allowSyntheticDefaultImports: true, noEmit: false, From aaaa8e93e1d2b5f852cd85fd3e8479221fbf377e Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 13:35:33 -0400 Subject: [PATCH 4/8] Add default module/target --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index d7bd6c8e..fd60391e 100644 --- a/src/index.js +++ b/src/index.js @@ -334,7 +334,8 @@ function ncc ( transpileOnly, compiler: eval('__dirname + "/typescript.js"'), compilerOptions: { - module: 'esnext' + module: 'esnext', + target: 'esnext', ...fullTsconfig.compilerOptions, allowSyntheticDefaultImports: true, noEmit: false, From 1b9077a3a8c24f7a66583f87546cc8d3701ea156 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 14:32:18 -0400 Subject: [PATCH 5/8] Fix bundle-subasset2 test --- test/unit/bundle-subasset2/output.js | 54 +++------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/test/unit/bundle-subasset2/output.js b/test/unit/bundle-subasset2/output.js index 73c9c162..2350d9b3 100644 --- a/test/unit/bundle-subasset2/output.js +++ b/test/unit/bundle-subasset2/output.js @@ -88,60 +88,14 @@ var external_piscina_default = /*#__PURE__*/__nccwpck_require__.n(external_pisci ;// CONCATENATED MODULE: external "path" const external_path_namespaceObject = require("path"); ;// CONCATENATED MODULE: ./test/unit/bundle-subasset2/input.ts -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var piscina = new (external_piscina_default())({ +const piscina = new (external_piscina_default())({ filename: __nccwpck_require__.ab + "pi-bridge.js", }); -(function () { - return __awaiter(this, void 0, void 0, function () { - var result; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, piscina.runTask(2)]; - case 1: - result = _a.sent(); - console.log(result); - return [2 /*return*/]; - } - }); - }); +(async function () { + const result = await piscina.runTask(2); + console.log(result); })(); module.exports = __webpack_exports__; From bc9a5572cadfc227034425641591ca6157888745 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 14:42:59 -0400 Subject: [PATCH 6/8] Add ts-mixed-modules test --- test/unit/ts-mixed-modules/input.ts | 7 ++ test/unit/ts-mixed-modules/output-coverage.js | 94 +++++++++++++++++++ test/unit/ts-mixed-modules/output.js | 94 +++++++++++++++++++ test/unit/ts-mixed-modules/tsconfig.json | 12 +++ test/unit/ts-mixed-modules/types.ts | 3 + 5 files changed, 210 insertions(+) create mode 100644 test/unit/ts-mixed-modules/input.ts create mode 100644 test/unit/ts-mixed-modules/output-coverage.js create mode 100644 test/unit/ts-mixed-modules/output.js create mode 100644 test/unit/ts-mixed-modules/tsconfig.json create mode 100644 test/unit/ts-mixed-modules/types.ts diff --git a/test/unit/ts-mixed-modules/input.ts b/test/unit/ts-mixed-modules/input.ts new file mode 100644 index 00000000..72d8c547 --- /dev/null +++ b/test/unit/ts-mixed-modules/input.ts @@ -0,0 +1,7 @@ +import { Config } from './types' + +const config: Config = { + routes: ['/foo'] +}; + +module.exports = config; \ No newline at end of file diff --git a/test/unit/ts-mixed-modules/output-coverage.js b/test/unit/ts-mixed-modules/output-coverage.js new file mode 100644 index 00000000..426ca36e --- /dev/null +++ b/test/unit/ts-mixed-modules/output-coverage.js @@ -0,0 +1,94 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 119: +/***/ ((module, __webpack_exports__, __nccwpck_require__) => { + + __nccwpck_require__.r(__webpack_exports__); + /* module decorator */ module = __nccwpck_require__.hmd(module); + const config = { + routes: ['/foo'] + }; + module.exports = config; + + + + /***/ }) + + /******/ }); + /************************************************************************/ + /******/ // The module cache + /******/ var __webpack_module_cache__ = {}; + /******/ + /******/ // The require function + /******/ function __nccwpck_require__(moduleId) { + /******/ // Check if module is in cache + /******/ var cachedModule = __webpack_module_cache__[moduleId]; + /******/ if (cachedModule !== undefined) { + /******/ return cachedModule.exports; + /******/ } + /******/ // Create a new module (and put it into the cache) + /******/ var module = __webpack_module_cache__[moduleId] = { + /******/ id: moduleId, + /******/ loaded: false, + /******/ exports: {} + /******/ }; + /******/ + /******/ // Execute the module function + /******/ var threw = true; + /******/ try { + /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + /******/ threw = false; + /******/ } finally { + /******/ if(threw) delete __webpack_module_cache__[moduleId]; + /******/ } + /******/ + /******/ // Flag the module as loaded + /******/ module.loaded = true; + /******/ + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } + /******/ + /************************************************************************/ + /******/ /* webpack/runtime/harmony module decorator */ + /******/ (() => { + /******/ __nccwpck_require__.hmd = (module) => { + /******/ module = Object.create(module); + /******/ if (!module.children) module.children = []; + /******/ Object.defineProperty(module, 'exports', { + /******/ enumerable: true, + /******/ set: () => { + /******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); + /******/ } + /******/ }); + /******/ return module; + /******/ }; + /******/ })(); + /******/ + /******/ /* webpack/runtime/make namespace object */ + /******/ (() => { + /******/ // define __esModule on exports + /******/ __nccwpck_require__.r = (exports) => { + /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + /******/ } + /******/ Object.defineProperty(exports, '__esModule', { value: true }); + /******/ }; + /******/ })(); + /******/ + /******/ /* webpack/runtime/compat */ + /******/ + /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; + /******/ + /************************************************************************/ + /******/ + /******/ // startup + /******/ // Load entry module and return exports + /******/ // This entry module is referenced by other modules so it can't be inlined + /******/ var __webpack_exports__ = __nccwpck_require__(119); + /******/ module.exports = __webpack_exports__; + /******/ + /******/ })() + ; \ No newline at end of file diff --git a/test/unit/ts-mixed-modules/output.js b/test/unit/ts-mixed-modules/output.js new file mode 100644 index 00000000..426ca36e --- /dev/null +++ b/test/unit/ts-mixed-modules/output.js @@ -0,0 +1,94 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 119: +/***/ ((module, __webpack_exports__, __nccwpck_require__) => { + + __nccwpck_require__.r(__webpack_exports__); + /* module decorator */ module = __nccwpck_require__.hmd(module); + const config = { + routes: ['/foo'] + }; + module.exports = config; + + + + /***/ }) + + /******/ }); + /************************************************************************/ + /******/ // The module cache + /******/ var __webpack_module_cache__ = {}; + /******/ + /******/ // The require function + /******/ function __nccwpck_require__(moduleId) { + /******/ // Check if module is in cache + /******/ var cachedModule = __webpack_module_cache__[moduleId]; + /******/ if (cachedModule !== undefined) { + /******/ return cachedModule.exports; + /******/ } + /******/ // Create a new module (and put it into the cache) + /******/ var module = __webpack_module_cache__[moduleId] = { + /******/ id: moduleId, + /******/ loaded: false, + /******/ exports: {} + /******/ }; + /******/ + /******/ // Execute the module function + /******/ var threw = true; + /******/ try { + /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + /******/ threw = false; + /******/ } finally { + /******/ if(threw) delete __webpack_module_cache__[moduleId]; + /******/ } + /******/ + /******/ // Flag the module as loaded + /******/ module.loaded = true; + /******/ + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } + /******/ + /************************************************************************/ + /******/ /* webpack/runtime/harmony module decorator */ + /******/ (() => { + /******/ __nccwpck_require__.hmd = (module) => { + /******/ module = Object.create(module); + /******/ if (!module.children) module.children = []; + /******/ Object.defineProperty(module, 'exports', { + /******/ enumerable: true, + /******/ set: () => { + /******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); + /******/ } + /******/ }); + /******/ return module; + /******/ }; + /******/ })(); + /******/ + /******/ /* webpack/runtime/make namespace object */ + /******/ (() => { + /******/ // define __esModule on exports + /******/ __nccwpck_require__.r = (exports) => { + /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + /******/ } + /******/ Object.defineProperty(exports, '__esModule', { value: true }); + /******/ }; + /******/ })(); + /******/ + /******/ /* webpack/runtime/compat */ + /******/ + /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; + /******/ + /************************************************************************/ + /******/ + /******/ // startup + /******/ // Load entry module and return exports + /******/ // This entry module is referenced by other modules so it can't be inlined + /******/ var __webpack_exports__ = __nccwpck_require__(119); + /******/ module.exports = __webpack_exports__; + /******/ + /******/ })() + ; \ No newline at end of file diff --git a/test/unit/ts-mixed-modules/tsconfig.json b/test/unit/ts-mixed-modules/tsconfig.json new file mode 100644 index 00000000..f74cf809 --- /dev/null +++ b/test/unit/ts-mixed-modules/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "esModuleInterop": true, + "lib": ["esnext"], + "module": "commonjs", + "moduleResolution": "node", + "outDir": "dist", + "strict": true, + "target": "es2020" + } + } \ No newline at end of file diff --git a/test/unit/ts-mixed-modules/types.ts b/test/unit/ts-mixed-modules/types.ts new file mode 100644 index 00000000..b817c628 --- /dev/null +++ b/test/unit/ts-mixed-modules/types.ts @@ -0,0 +1,3 @@ +export interface Config { + routes: string[]; +} \ No newline at end of file From d424517ab561d01151844613bde09f36ff9b87f3 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 15:48:46 -0400 Subject: [PATCH 7/8] Fix output-coverage --- test/unit/bundle-subasset2/output-coverage.js | 54 +------ test/unit/ts-exts/output-coverage.js | 83 +++++++--- test/unit/ts-mixed-modules/output-coverage.js | 148 +++++++----------- .../tsconfig-paths-allowjs/output-coverage.js | 78 +++++++-- .../output-coverage.js | 68 +++++--- test/unit/tsconfig-paths/output-coverage.js | 68 +++++--- 6 files changed, 291 insertions(+), 208 deletions(-) diff --git a/test/unit/bundle-subasset2/output-coverage.js b/test/unit/bundle-subasset2/output-coverage.js index 73c9c162..2350d9b3 100644 --- a/test/unit/bundle-subasset2/output-coverage.js +++ b/test/unit/bundle-subasset2/output-coverage.js @@ -88,60 +88,14 @@ var external_piscina_default = /*#__PURE__*/__nccwpck_require__.n(external_pisci ;// CONCATENATED MODULE: external "path" const external_path_namespaceObject = require("path"); ;// CONCATENATED MODULE: ./test/unit/bundle-subasset2/input.ts -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var piscina = new (external_piscina_default())({ +const piscina = new (external_piscina_default())({ filename: __nccwpck_require__.ab + "pi-bridge.js", }); -(function () { - return __awaiter(this, void 0, void 0, function () { - var result; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, piscina.runTask(2)]; - case 1: - result = _a.sent(); - console.log(result); - return [2 /*return*/]; - } - }); - }); +(async function () { + const result = await piscina.runTask(2); + console.log(result); })(); module.exports = __webpack_exports__; diff --git a/test/unit/ts-exts/output-coverage.js b/test/unit/ts-exts/output-coverage.js index df9717a3..6a6e64e7 100644 --- a/test/unit/ts-exts/output-coverage.js +++ b/test/unit/ts-exts/output-coverage.js @@ -1,38 +1,77 @@ /******/ (() => { // webpackBootstrap /******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; -/******/ +/******/ var __webpack_modules__ = ({ + +/***/ 119: +/***/ ((__unused_webpack_module, exports) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.default = {}; + + +/***/ }), + +/***/ 43: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.default = void 0; +var dep_dep_js_1 = __nccwpck_require__(119); +Object.defineProperty(exports, "default", ({ enumerable: true, get: function () { return dep_dep_js_1.default; } })); + + +/***/ }) + +/******/ }); /************************************************************************/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} /******/ }; -/******/ })(); /******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ /******/ /* webpack/runtime/compat */ /******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; /******/ /************************************************************************/ var __webpack_exports__ = {}; -// ESM COMPAT FLAG -__nccwpck_require__.r(__webpack_exports__); - -;// CONCATENATED MODULE: ./test/unit/ts-exts/dep-dep.ts -/* harmony default export */ const dep_dep = ({}); - -;// CONCATENATED MODULE: ./test/unit/ts-exts/dep.ts - +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +var exports = __webpack_exports__; -;// CONCATENATED MODULE: ./test/unit/ts-exts/input.ts +Object.defineProperty(exports, "__esModule", ({ value: true })); +const dep_js_1 = __nccwpck_require__(43); +console.log(dep_js_1.default); -console.log(dep_dep); +})(); module.exports = __webpack_exports__; /******/ })() diff --git a/test/unit/ts-mixed-modules/output-coverage.js b/test/unit/ts-mixed-modules/output-coverage.js index 426ca36e..48075d4d 100644 --- a/test/unit/ts-mixed-modules/output-coverage.js +++ b/test/unit/ts-mixed-modules/output-coverage.js @@ -2,93 +2,63 @@ /******/ "use strict"; /******/ var __webpack_modules__ = ({ -/***/ 119: -/***/ ((module, __webpack_exports__, __nccwpck_require__) => { +/***/ 866: +/***/ ((module, exports) => { - __nccwpck_require__.r(__webpack_exports__); - /* module decorator */ module = __nccwpck_require__.hmd(module); - const config = { - routes: ['/foo'] - }; - module.exports = config; - - - - /***/ }) - - /******/ }); - /************************************************************************/ - /******/ // The module cache - /******/ var __webpack_module_cache__ = {}; - /******/ - /******/ // The require function - /******/ function __nccwpck_require__(moduleId) { - /******/ // Check if module is in cache - /******/ var cachedModule = __webpack_module_cache__[moduleId]; - /******/ if (cachedModule !== undefined) { - /******/ return cachedModule.exports; - /******/ } - /******/ // Create a new module (and put it into the cache) - /******/ var module = __webpack_module_cache__[moduleId] = { - /******/ id: moduleId, - /******/ loaded: false, - /******/ exports: {} - /******/ }; - /******/ - /******/ // Execute the module function - /******/ var threw = true; - /******/ try { - /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); - /******/ threw = false; - /******/ } finally { - /******/ if(threw) delete __webpack_module_cache__[moduleId]; - /******/ } - /******/ - /******/ // Flag the module as loaded - /******/ module.loaded = true; - /******/ - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - /******/ - /************************************************************************/ - /******/ /* webpack/runtime/harmony module decorator */ - /******/ (() => { - /******/ __nccwpck_require__.hmd = (module) => { - /******/ module = Object.create(module); - /******/ if (!module.children) module.children = []; - /******/ Object.defineProperty(module, 'exports', { - /******/ enumerable: true, - /******/ set: () => { - /******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); - /******/ } - /******/ }); - /******/ return module; - /******/ }; - /******/ })(); - /******/ - /******/ /* webpack/runtime/make namespace object */ - /******/ (() => { - /******/ // define __esModule on exports - /******/ __nccwpck_require__.r = (exports) => { - /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); - /******/ } - /******/ Object.defineProperty(exports, '__esModule', { value: true }); - /******/ }; - /******/ })(); - /******/ - /******/ /* webpack/runtime/compat */ - /******/ - /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; - /******/ - /************************************************************************/ - /******/ - /******/ // startup - /******/ // Load entry module and return exports - /******/ // This entry module is referenced by other modules so it can't be inlined - /******/ var __webpack_exports__ = __nccwpck_require__(119); - /******/ module.exports = __webpack_exports__; - /******/ - /******/ })() - ; \ No newline at end of file + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const config = { + routes: ['/foo'] +}; +module.exports = config; + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __nccwpck_require__(866); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; \ No newline at end of file diff --git a/test/unit/tsconfig-paths-allowjs/output-coverage.js b/test/unit/tsconfig-paths-allowjs/output-coverage.js index bccf94b9..cd8b68e0 100644 --- a/test/unit/tsconfig-paths-allowjs/output-coverage.js +++ b/test/unit/tsconfig-paths-allowjs/output-coverage.js @@ -1,9 +1,69 @@ /******/ (() => { // webpackBootstrap /******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; +/******/ var __webpack_modules__ = ({ + +/***/ 306: +/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => { + +__nccwpck_require__.r(__webpack_exports__); +/* harmony export */ __nccwpck_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({}); + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } /******/ /************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __nccwpck_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports @@ -21,15 +81,15 @@ /******/ /************************************************************************/ var __webpack_exports__ = {}; -// ESM COMPAT FLAG -__nccwpck_require__.r(__webpack_exports__); - -;// CONCATENATED MODULE: ./test/unit/tsconfig-paths-allowjs/module.js -/* harmony default export */ const tsconfig_paths_allowjs_module = ({}); +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +var exports = __webpack_exports__; -;// CONCATENATED MODULE: ./test/unit/tsconfig-paths-allowjs/input.ts +Object.defineProperty(exports, "__esModule", ({ value: true })); +const _module_1 = __nccwpck_require__(306); +console.log(_module_1.default); -console.log(tsconfig_paths_allowjs_module); +})(); module.exports = __webpack_exports__; /******/ })() diff --git a/test/unit/tsconfig-paths-conflicting-external/output-coverage.js b/test/unit/tsconfig-paths-conflicting-external/output-coverage.js index cdd53d92..acab44d5 100644 --- a/test/unit/tsconfig-paths-conflicting-external/output-coverage.js +++ b/test/unit/tsconfig-paths-conflicting-external/output-coverage.js @@ -1,35 +1,65 @@ /******/ (() => { // webpackBootstrap /******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; -/******/ +/******/ var __webpack_modules__ = ({ + +/***/ 775: +/***/ ((__unused_webpack_module, exports) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.default = {}; + + +/***/ }) + +/******/ }); /************************************************************************/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} /******/ }; -/******/ })(); /******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ /******/ /* webpack/runtime/compat */ /******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; /******/ /************************************************************************/ var __webpack_exports__ = {}; -// ESM COMPAT FLAG -__nccwpck_require__.r(__webpack_exports__); - -;// CONCATENATED MODULE: ./test/unit/tsconfig-paths-conflicting-external/module.ts -/* harmony default export */ const tsconfig_paths_conflicting_external_module = ({}); +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +var exports = __webpack_exports__; -;// CONCATENATED MODULE: ./test/unit/tsconfig-paths-conflicting-external/input.ts +Object.defineProperty(exports, "__esModule", ({ value: true })); +const _module_1 = __nccwpck_require__(775); +console.log(_module_1.default); -console.log(tsconfig_paths_conflicting_external_module); +})(); module.exports = __webpack_exports__; /******/ })() diff --git a/test/unit/tsconfig-paths/output-coverage.js b/test/unit/tsconfig-paths/output-coverage.js index 58ad7ae4..5d9a60e1 100644 --- a/test/unit/tsconfig-paths/output-coverage.js +++ b/test/unit/tsconfig-paths/output-coverage.js @@ -1,35 +1,65 @@ /******/ (() => { // webpackBootstrap /******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; -/******/ +/******/ var __webpack_modules__ = ({ + +/***/ 520: +/***/ ((__unused_webpack_module, exports) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.default = {}; + + +/***/ }) + +/******/ }); /************************************************************************/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} /******/ }; -/******/ })(); /******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ /******/ /* webpack/runtime/compat */ /******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; /******/ /************************************************************************/ var __webpack_exports__ = {}; -// ESM COMPAT FLAG -__nccwpck_require__.r(__webpack_exports__); - -;// CONCATENATED MODULE: ./test/unit/tsconfig-paths/module.ts -/* harmony default export */ const tsconfig_paths_module = ({}); +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +var exports = __webpack_exports__; -;// CONCATENATED MODULE: ./test/unit/tsconfig-paths/input.ts +Object.defineProperty(exports, "__esModule", ({ value: true })); +const _module_1 = __nccwpck_require__(520); +console.log(_module_1.default); -console.log(tsconfig_paths_module); +})(); module.exports = __webpack_exports__; /******/ })() From 6d5d6eb80becac720b020b0ac4d21d644409988e Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Sep 2021 16:00:00 -0400 Subject: [PATCH 8/8] Fix ts-mixed-modues output.js --- test/unit/ts-mixed-modules/output.js | 174 +++++++++++++-------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/test/unit/ts-mixed-modules/output.js b/test/unit/ts-mixed-modules/output.js index 426ca36e..55afe872 100644 --- a/test/unit/ts-mixed-modules/output.js +++ b/test/unit/ts-mixed-modules/output.js @@ -5,90 +5,90 @@ /***/ 119: /***/ ((module, __webpack_exports__, __nccwpck_require__) => { - __nccwpck_require__.r(__webpack_exports__); - /* module decorator */ module = __nccwpck_require__.hmd(module); - const config = { - routes: ['/foo'] - }; - module.exports = config; - - - - /***/ }) - - /******/ }); - /************************************************************************/ - /******/ // The module cache - /******/ var __webpack_module_cache__ = {}; - /******/ - /******/ // The require function - /******/ function __nccwpck_require__(moduleId) { - /******/ // Check if module is in cache - /******/ var cachedModule = __webpack_module_cache__[moduleId]; - /******/ if (cachedModule !== undefined) { - /******/ return cachedModule.exports; - /******/ } - /******/ // Create a new module (and put it into the cache) - /******/ var module = __webpack_module_cache__[moduleId] = { - /******/ id: moduleId, - /******/ loaded: false, - /******/ exports: {} - /******/ }; - /******/ - /******/ // Execute the module function - /******/ var threw = true; - /******/ try { - /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); - /******/ threw = false; - /******/ } finally { - /******/ if(threw) delete __webpack_module_cache__[moduleId]; - /******/ } - /******/ - /******/ // Flag the module as loaded - /******/ module.loaded = true; - /******/ - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - /******/ - /************************************************************************/ - /******/ /* webpack/runtime/harmony module decorator */ - /******/ (() => { - /******/ __nccwpck_require__.hmd = (module) => { - /******/ module = Object.create(module); - /******/ if (!module.children) module.children = []; - /******/ Object.defineProperty(module, 'exports', { - /******/ enumerable: true, - /******/ set: () => { - /******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); - /******/ } - /******/ }); - /******/ return module; - /******/ }; - /******/ })(); - /******/ - /******/ /* webpack/runtime/make namespace object */ - /******/ (() => { - /******/ // define __esModule on exports - /******/ __nccwpck_require__.r = (exports) => { - /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); - /******/ } - /******/ Object.defineProperty(exports, '__esModule', { value: true }); - /******/ }; - /******/ })(); - /******/ - /******/ /* webpack/runtime/compat */ - /******/ - /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; - /******/ - /************************************************************************/ - /******/ - /******/ // startup - /******/ // Load entry module and return exports - /******/ // This entry module is referenced by other modules so it can't be inlined - /******/ var __webpack_exports__ = __nccwpck_require__(119); - /******/ module.exports = __webpack_exports__; - /******/ - /******/ })() - ; \ No newline at end of file +__nccwpck_require__.r(__webpack_exports__); +/* module decorator */ module = __nccwpck_require__.hmd(module); +const config = { + routes: ['/foo'] +}; +module.exports = config; + + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ loaded: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/harmony module decorator */ +/******/ (() => { +/******/ __nccwpck_require__.hmd = (module) => { +/******/ module = Object.create(module); +/******/ if (!module.children) module.children = []; +/******/ Object.defineProperty(module, 'exports', { +/******/ enumerable: true, +/******/ set: () => { +/******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); +/******/ } +/******/ }); +/******/ return module; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __nccwpck_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __nccwpck_require__(119); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; \ No newline at end of file