question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Symlinked node_modules directory confuses dts-bundle-generator

See original GitHub issue

I have to admit, this is probably a quite uncommon use case, but still wanted to report it because maybe it can be fixed easily.

This is based on the same example as #37. Rename your node_modules directory and symlink it:

mv node_modules .node_modules_develop
ln -s .node_modules_develop node_modules

Then extract the typings. You will get a huge definitions file with a lot of inlined types. It seems like the symlink is confusing the logic that figures out how to deal with a dependency.

I’ve been using the symlink for a long time now as a technique to make it easy and fast to switch between the modules required for my develop and release branches. It hasn’t caused any problems with NPM itself or other tools so far.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rhuitlcommented, Jun 26, 2018

Yes, of course. Create a new directory. Place these files:

app.ts

export function test(): void { }

package.json

{
  "name": "dts-bundle-generator-bugreport",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "build": "tsc",
    "typings": "dts-bundle-generator --verbose --disable-symlinks-following -o app.d.ts app.ts"
  },
  "dependencies": {},
  "devDependencies": {
    "dts-bundle-generator": "^1.5.0",
    "typescript": "^2.9.1"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "declaration": true,
    "lib": ["es2015", "dom"]
  },
  "files": ["app.ts"]
}

Run npm install Run npm run typings, look at console output and the generated typings file which look like they should.

Move the node_modules directory and symlink it:

mv node_modules foobar
ln -s foobar node_modules

Run npm run typings again, this time the console has a lot of output and the typings file contains typings from es2015 and dom.

0reactions
timocovcommented, Jun 29, 2018

Version 1.6.0 is published.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dts-bundle-generator - npm
Start using dts-bundle-generator in your project by running `npm i ... (EXPERIMENTAL) Disables resolving of symlinks to the original path.
Read more >
Building an NPM Package - Notes, Tips, and Troubleshooting
NodeJS Docs: "Loading from node_modules folder" (explains module resolution algorithm). Here is the creator, (and founder + former CEO) of NPM, ...
Read more >
Releases.md | deno@v1.9.1
A modern runtime for JavaScript and TypeScript.
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/24 17 ...
symlinks " status:UNCONFIRMED resolution: severity:enhancement ... Bug:382827 - "sys-apps/portage-2.1.10.11 crashes with confusing error when out of memory: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found