-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
.js
imports from typescript (#510)
This resolves vercel/ncc#508 in allowing the pattern for TypeScript code using `.js` extensions to reference other TypeScript files. This is currently recommended by the TypeScript team (microsoft/TypeScript#16577 (comment)) as an approach for writing TypeScript that will include the file extensions in the output files when using `tsc` manually, resulting in Node.js and browser compatibility for the output. With this PR, ncc doesn't have to break enabling this workflow for users, while remaining backwards compatible with the previous behaviour so it would be fine to release this as a minor.
- Loading branch information
1 parent
573508f
commit b4edcf4
Showing
7 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default } from './dep-dep.js'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import dep from './dep.js'; | ||
|
||
console.log(dep); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
module.exports = | ||
/******/ (function(modules, runtime) { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ // 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; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ __webpack_require__.ab = __dirname + "/"; | ||
/******/ | ||
/******/ // the startup function | ||
/******/ function startup() { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(368); | ||
/******/ }; | ||
/******/ | ||
/******/ // run startup | ||
/******/ return startup(); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ({ | ||
|
||
/***/ 43: | ||
/***/ (function(__unusedmodule, exports, __webpack_require__) { | ||
|
||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
var dep_dep_js_1 = __webpack_require__(119); | ||
exports["default"] = dep_dep_js_1["default"]; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 119: | ||
/***/ (function(__unusedmodule, exports) { | ||
|
||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
exports["default"] = {}; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 368: | ||
/***/ (function(__unusedmodule, exports, __webpack_require__) { | ||
|
||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
var dep_js_1 = __webpack_require__(43); | ||
console.log(dep_js_1["default"]); | ||
|
||
|
||
/***/ }) | ||
|
||
/******/ }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
module.exports = | ||
/******/ (function(modules, runtime) { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ // 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; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ __webpack_require__.ab = __dirname + "/"; | ||
/******/ | ||
/******/ // the startup function | ||
/******/ function startup() { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(578); | ||
/******/ }; | ||
/******/ | ||
/******/ // run startup | ||
/******/ return startup(); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ({ | ||
|
||
/***/ 578: | ||
/***/ (function(__unusedmodule, exports, __webpack_require__) { | ||
|
||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
var dep_js_1 = __webpack_require__(975); | ||
console.log(dep_js_1["default"]); | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 668: | ||
/***/ (function(__unusedmodule, exports) { | ||
|
||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
exports["default"] = {}; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 975: | ||
/***/ (function(__unusedmodule, exports, __webpack_require__) { | ||
|
||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
var dep_dep_js_1 = __webpack_require__(668); | ||
exports["default"] = dep_dep_js_1["default"]; | ||
|
||
|
||
/***/ }) | ||
|
||
/******/ }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@*": ["./*"] | ||
} | ||
} | ||
} |