-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2939fa
commit b8243bb
Showing
7 changed files
with
86 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
node_modules/ |
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,37 @@ | ||
# tsc-alias-bug-demo | ||
|
||
Steps to reproduce https://github.com/justkey007/tsc-alias/issues/154: | ||
|
||
1) Install dependencies | ||
```sh | ||
npm install | ||
``` | ||
|
||
2) Start the app using `ts-node` | ||
```sh | ||
npm start | ||
``` | ||
Output: | ||
``` | ||
[Function: i18nConfigure] | ||
Translation | ||
``` | ||
|
||
3) Compile TS files and start the app | ||
```sh | ||
npm run build && node dist/index.js | ||
``` | ||
Output: | ||
``` | ||
console.log(i18n_1.default.configure); | ||
^ | ||
TypeError: Cannot read property 'configure' of undefined | ||
``` | ||
It happens because `dist/i18n/index.js` contains | ||
```js | ||
const i18n_1 = __importDefault(require("../i18n")); | ||
``` | ||
instead of | ||
```js | ||
const i18n_1 = __importDefault(require("i18n")); | ||
``` |
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,26 @@ | ||
{ | ||
"name": "tsc-alias-bug-demo", | ||
"version": "1.0.0", | ||
"description": "Demonstration of a bug with incorrect module path", | ||
"private": true, | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "npm install && tsc && tsc-alias", | ||
"start": "npm run build && node dist/index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Jokero/tsc-alias-bug.git" | ||
}, | ||
"author": "Dmitry Kirilyuk <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/i18n": "^0.13.6", | ||
"ts-node": "^10.9.1", | ||
"tsc-alias": "^1.8.3", | ||
"typescript": "^4.9.5" | ||
}, | ||
"dependencies": { | ||
"i18n": "^0.15.1" | ||
} | ||
} |
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,5 @@ | ||
import i18n from 'i18n'; | ||
|
||
console.log(i18n.configure); | ||
|
||
export default () => 'Translation'; |
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 i18n from './i18n'; | ||
|
||
console.log(i18n()); |
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", | ||
"esModuleInterop": true, | ||
"moduleResolution": "node", | ||
"target": "esnext", | ||
"outDir": "dist" | ||
}, | ||
"include": ["src/**/*"] | ||
} |
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