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.

Additional usage: flow style comment

See original GitHub issue

Hey cool project! 😄

I was thinking another usage could be to have flow (// @flow) style comments at the start of a file to be ran through preval.

That way the consumer of a file would not need to annotate an import. Instead a module would have the scope defined to be pre-evaluated, without the need to explicitly import babel-plugin-preval.

Example:

foo.js

// @preval
const fs = require('fs');
module.exports = fs.readFileSync(require.resolve('./foo.txt'), 'utf8');

//      ↓ ↓ ↓ ↓ ↓ ↓
module.exports = "Hello world!"

bar.js

const foo = require('./foo');

console.log(foo); // Hello world!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
kentcdoddscommented, Jul 6, 2017

Supported!

2reactions
mattphillipscommented, Jul 5, 2017

Nice one lets see how I get on 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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