Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flow] The parameter passed to require() must be a literal string #107

Closed
steida opened this issue May 5, 2017 · 9 comments
Closed

[flow] The parameter passed to require() must be a literal string #107

steida opened this issue May 5, 2017 · 9 comments

Comments

@steida
Copy link

steida commented May 5, 2017

With 0.4.4 version.

if (state.opts.plugins) {
  const pluginsVisitors = state.opts.plugins.map((pluginName) => {
    const plugin = require(pluginName);
    return plugin({ template, types }).visitor;
  });

  programPath.traverse(visitors.merge(pluginsVisitors));
}
@oliviertassinari
Copy link
Owner

Is that an issue with flow parsing the source code of the project? I'm not sure how we could address it.

@steida
Copy link
Author

steida commented May 5, 2017

Don't use dynamic require string I guess. I see, not sure how to solve it.

@oliviertassinari
Copy link
Owner

oliviertassinari commented May 5, 2017

Regarding the why of this new lines of code, it can be summarized with that tweet.

I have been adding that line to the .flowconfig file. The best solution I could find.

[options]

module.ignore_non_literal_requires=true

@steida
Copy link
Author

steida commented May 6, 2017

Thank you for the hint.

@oliviertassinari
Copy link
Owner

Also, you can tell flow to ignore the source of this package. I think that it's a better alternative to ignore_non_literal_requires.

@oliviertassinari oliviertassinari changed the title The parameter passed to require() must be a literal string. [flow] The parameter passed to require() must be a literal string May 18, 2017
@dapetcu21 dapetcu21 mentioned this issue Jun 15, 2017
@Andarist
Copy link

Andarist commented Jul 5, 2017

@oliviertassinari

Im not that sure what exact purpose this dynamic require serves here. From what I see its needed somehow because of certain combination of babel plugins and their unsafe ordering. Will it be possible to get rid of it once babel7 gets released which will address issue of plugins ordering by adding an option to specify which plugin should run first and which plugin should run later?

@oliviertassinari
Copy link
Owner

oliviertassinari commented Jul 5, 2017

babel7 gets released which will address issue of plugins ordering by adding an option to specify which plugin should run first and which plugin should run later?

@Andarist Yes, hopefully, we should be able to remove the plugins option and the associated code.

@sandersky
Copy link

Worst case if you want to solve it in this repo you can add // $FlowFixMe above the line in question.

@oliviertassinari
Copy link
Owner

I'm closing the issue. I haven't seen a report for a long time. I'm assuming Flow stopped linting the node_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants