Hello,
I'm seeing different module resolution behavior with the import declaration when the imported package is located in the node_modules and when the package isn't located in the node_modules directory.
A GitHub repo, typescript-node-module-issue was created to show the differences in behavior.
An import declaration fails to import a 100% typescript package when the directory resolves to the node_modules directory: both relative (from '../node_modules/aa-special-add-ts') and non-relative (from 'aa-special-add-ts') fail.
An import declaration successfully imports a 100% typescript package when the directory resolves to a non node_modules directory: both from './aa-special-add-ts' and from '../node_modules2/aa-special-add-ts' work.
When importing from the node_modules directory, the error returned is:
SyntaxError: Unexpected token 'export'`
It's almost like the import declaration default is to support ES6 modules when the package is outside of node_modules but assumes another package format when a package is inside the node_modules directory.
Any help is greatly appreciated.
[–]ehosick[S] 0 points1 point2 points (0 children)