Followup to #89 and #87.
Current Behavior
Running tsdx create initializes a tsconfig.json with absolute module resolution relative to the src directory. I have VS Code configured to prefer absolute paths if possible when importing modules, so if I have a module like...
src/foo.ts
export const foo = () => 'bar';
And I type
and hit Tab, VS Code will add the following import:
import { foo } from 'foo';
This is valid and properly resolved by Typescript. However, if I compile my library, the current Rollup behavior assumes that foo is an external module and doesn't include it in the bundle.
Expected behavior
I would expect my local modules to be included in my bundle regardless of whether I imported them using 'absolute' resolution as above,
OR
I would expect tsdx to not initialize tsconfig.json with resolution rules which would lead me to believe importing modules relative to src is a valid thing to do.
Suggested solution(s)
Either fix the external modules rules to properly understand local src-based resolution, or remove the default src resolution rules from tsconfig.json to avoid confusing users.
Additional context
I probably hit this more often than most because I have configured my editor to prefer absolute path resolutions if available.
Your environment
| Software |
Version(s) |
| TSDX |
0.5.7 |
| TypeScript |
3.4.3 |
| Browser |
N/A |
| npm/Yarn |
NPM 6.2.0 |
| Operating System |
Windows 10 |
Followup to #89 and #87.
Current Behavior
Running
tsdx createinitializes atsconfig.jsonwith absolute module resolution relative to thesrcdirectory. I have VS Code configured to prefer absolute paths if possible when importing modules, so if I have a module like...src/foo.tsAnd I type
and hit Tab, VS Code will add the following import:
This is valid and properly resolved by Typescript. However, if I compile my library, the current Rollup behavior assumes that
foois an external module and doesn't include it in the bundle.Expected behavior
I would expect my local modules to be included in my bundle regardless of whether I imported them using 'absolute' resolution as above,
OR
I would expect
tsdxto not initializetsconfig.jsonwith resolution rules which would lead me to believe importing modules relative tosrcis a valid thing to do.Suggested solution(s)
Either fix the external modules rules to properly understand local
src-based resolution, or remove the defaultsrcresolution rules fromtsconfig.jsonto avoid confusing users.Additional context
I probably hit this more often than most because I have configured my editor to prefer absolute path resolutions if available.
Your environment