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.

serving entry file with all imports

See original GitHub issue

Hi @cartant

this looks like a really good solution.

However until the IDEs will support automatic import of rxjs operators and stuff, this is not really comfortable to use.

What I’d like to propose (and of course to have) is another setting in e.g. tslint.json that allows to specify the file, let’s call it rxjs-modules.ts for instance, that contains all rxjs operators etc. for the particular project.

Of course, this rxjs-modules.ts should be imported in the beginning of main.ts so there is no race condition problem.

Is it possible to do so? Just to sum up:

  1. We have some file e.g. rxjs-modules.ts which we set up as another property in tslint.json
  2. This file is used to check every file in the project and it is end-programmer’s responsibility to import this file before all other imports in his entry file.

Then everybody can decide for his project: whether to import everything inside of one single file or import it in each file separately.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cartantcommented, Jul 18, 2017

@smnbbrv I’ve added some new options that are closely related to this issue. The detection of unused imports (mentioned in this issue) is now implemented. See #2.

1reaction
cartantcommented, May 30, 2017

I’ve published version 1.1.0 which includes the file option. See the README for more information.

The change was really simple. However, TypeScript’s backslash normalization and file case canonicalization caused the usual headaches.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python import: Advanced Techniques and Tips
While it's a good idea to separate scripts and libraries, all Python files can be both executed and imported. In a later section,...
Read more >
Is it possible to import modules from all files in a directory ...
However, I like the organization of having one module per file. I end up with imports like this: import ThingA from 'lib/things/ThingA'; ...
Read more >
5. The import system — Python 3.11.1 documentation
The first place checked during import search is sys.modules . This mapping serves as a cache of all modules that have been previously...
Read more >
Tips for New Importers and Exporters
Entry specialists work closely with import specialists and provide the technical processing expertise required to file the necessary ...
Read more >
How to Dynamically Import JavaScript with Import Maps
But by default most build systems will bundle all the code into one large file. The user will load the code regardless of...
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