Hi, I found that the import behavior is different between assets and node_modules if there is extension specified at the end of path.
{{ $js := resources.Get "js/index.ts" }}
{{ $js = $js | js.Build }}
<script src="{{ $js.Permalink }}"></script>
// assets/js/index.ts
import 'foo/index.js'; // Specify the extension as `js`.
// assets/foo/index.ts
console.log('assets/foo/index.ts');
// node_modules/foo/index.ts
console.log('node_modules/foo/index.ts');
The node_modules/foo/index.ts will be imported, which is unexpected.
Structure
βββ assets
β βββ foo
β β βββ index.ts
β βββ js
β βββ index.ts
βββ node_modules
β βββ foo
β βββ index.ts
Full example can be found on GitHub - razonyang/hugo-lab at typescript-import.
Background
I want to create a WorkBox module that mount JS lib on assets, but canβt resolve the dependencies, since their source code import modules with .js ext.
For example: workbox/packages/workbox-routing/src/index.ts at v6 Β· GoogleChrome/workbox Β· GitHub.