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.

Request: Autoload Plugins w/Programmatic

See original GitHub issue

When used programmatically, fly doesn’t autoload & mount plugins, even though tasks are defined.

Minimal example: after creating new project, create following index.js and run node index.js

const Fly = require('Fly')
const fly = new Fly({
  tasks: {
    * default (fly){ yield fly.source('x.sass').sass().target('.') }
  }
})
fly.start()

Expected: new x.css file. Actual result: Unhandled rejection TypeError: fly.source(...).sass is not a function

I’ve also created minimal repo. Edit: Taken down since.

Node v6.9.1 LTS, npm v4.4.4, yarn v0.21.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
lukeedcommented, Mar 31, 2017

We care about this lib & like working on it 😜

1reaction
lukeedcommented, Apr 4, 2017

Sorry, forgot to update this thread.

I played with auto-loading if plugins: true, but found that it’s not 100% consistent. The problem is that load (and some of its internals) are coroutines, and you can’t use 'em inside a class constructor.

The closest I got was to set up an .on('autoloaded') listener, but that’s where the inconsistency pops up. It’s asynchronous, so (older) machines may spend more time finding plugins & requiring them than expected. While that’s happening, Tasks could have been started & already thrown due to the “methods not found” error.

I’ll get back to this later, but it’ll have to be a class method on Fly.

const fly = new Fly({ file: 'path/to/foobar.js' });

fly.autoload().then(() => {
  fly.start('taskA');
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Additional programmatic Grasshopper plugin loading options
Feature Request: Additional programmatic Grasshopper plugin loading options ... show that it is possible o “Load” grasshopper without the window appearing.
Read more >
Plugin autoload doesn't work for packages installed ... - GitHub
The old logic didn't require it to be listed in package.json, it could installed by prettier-plugins(this package contains all plugins he use),.
Read more >
Programmatic Usage - GraphQL Code Generator
You need to import the plugin in your favorite way; you can also use await import to lazy load it. Then, provide the...
Read more >
Autoloaded options - WordPress VIP Documentation
When a WordPress site receives a request, all of the options marked as autoload = yes are fetched and stored in memory for...
Read more >
Composer Autoloading within WordPress Plugin
Leverage Composer for autoloading. Breaking up a single .php file into many .php files introduces the need to then require all of those...
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