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.

Allow plugins to indicate dependencies on random files

See original GitHub issue

Feature Request

In contexts where Babel is running alongside a filesystem watcher, there are cases where a plugin may load an arbitrary file. Take a plugin like https://www.npmjs.com/package/babel-plugin-inline-import for example. Or some usecases of babel-plugin-macros.

It would be ideal if Babel had a way for plugins to indicate that these dependencies exist, so that if callers of Babel wanted to take that into account, they could. For example, Webpack has .addDependency, so that changes to that file will cause the loader to re-execute when the dependency is changed. We could easily use this API in babel-loader to handle this. Implementing a similar API in @babel/cli’s watcher wouldn’t be too bad either.

I don’t know how other Babel wrappers would fair, but if someone wanted to help investigate that, it would certainly help. Off the top off my head we’d want to check, at the very least, if the following have ways to register additional files to watch:

  • Meteor
  • Jest
  • Browserify
  • Gulp

Edit

We may also want to include in this work logic to help us take dependency file content into account for the purposes of cache invalidation. For example, babel-loader’s cacheDirectory option will not invalidate caches, if say a .browserlistrc file changes preset-env’s plugin list: https://github.com/babel/babel-loader/issues/690

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:45
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
jescalancommented, Jun 27, 2019

Going to aim to get it fixed for babel-loader specifically, at least to start. I’ll do a little writeup on my plan to fix and see if I can get some feedback here before moving forward.

4reactions
jescalancommented, Dec 4, 2019

Sadly, no update yet - I have this queued but it keeps sinking down the priorities for other things. In the meantime we are disabling the babel cache and getting by, albeit a bit more slowly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Composer v2.2 prompts to authorize plugins - Drupal
As of Composer 2.2.0, the allow-plugins option adds a layer of security allowing you to restrict which Composer plugins are able to execute ......
Read more >
Feature Project: Plugin Dependencies – Make WordPress Core
If your plugin is listing another as a dependency, then it's your job to make sure it stays compatible with the latest version...
Read more >
Dependency Management and WordPress: A Proposal
1. Third-Party Code via Composer. Any plugin or theme using third-party code needs to define their dependencies using a composer. json file, ...
Read more >
Meet Swift Package plugins - WWDC22 - Apple Developer
Discover how you can perform actions on Swift packages and Xcode projects with Swift package plugins. We'll go over how these plugins...
Read more >
Managing dependencies - Atlassian Developer
You declare dependencies in the POM file. ... Manifest instructions tell the plugin system what Java packages - and, optionally, ...
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