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.

Support writing configuration as webpack Loader option

See original GitHub issue

From https://github.com/piglovesyou/graphql-let/pull/78#issue-401108869

Ideally it should also be available as a Webpack Loader option.

The problem is the command-line execution, but maybe we can get it from webpack.config.ts. Reasonable spec would be:

  • Load config by the following priority:
    1. .graphql-let.yml
      • CWD is where the .graphql-let.yml is located
    2. webpack Loader option
      • If the paths are absolute, it respects as is
      • If the paths are relative, it recognizes config.context as CWD

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
piglovesyoucommented, Sep 4, 2020

Hi. True, it should be like the Babel’s configFile option, where babel-loader can pass all babel options OR a relative path to a config file. And yes, accepting a configFilePath option would be our first step.

The problem would be, graphql-let currently expects both .graphql-let.yml and webpackConfig.context are in process.cwd(). So the PR solving is supposed to have tests with changing these paths.

0reactions
hasparuscommented, Sep 9, 2020

I encountered two problems while using graphql-let in a Nx monorepo.

  1. I have two webpack configs (own for dev and Nx’s for prod) with different context, so I have two copies of .graphql-let.yml. This could be fixed with options.configFile accepting a path to the config.

  2. My CI build is failing unless I commit generated files, because on CI they’re generated in <root-dir>/apps/my-app-one/path/to/file.gql (production context) instead of <root-dir>/path/to/file.gql where TypeScript expects them. This could be fixed by options.configFile accepting full config or rootDir and cacheDir options in the loader… right?

Edit: I have something like this. https://github.com/hasparus/graphql-let/tree/loader-options-config-file/test/__fixtures/loader/monorepo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing a Loader - webpack
A loader is a node module that exports a function. This function is called when a resource should be transformed by this loader....
Read more >
Writing a custom webpack loader - Redd Developer
Here's how you apply loaders to files in a webpack configuration: ... Support imports of a custom file format (i.e. *.graphql or *.prisma...
Read more >
webpack-contrib/config-loader: [DEPRECATED] A ... - GitHub
config -loader supports configuration modules which export an Object , Array , Function , Promise , and Function which returns a Promise ....
Read more >
Getting Started With Webpack - Smashing Magazine
A webpack configuration file is a JavaScript file, written as a JavaScript ... option to use loaders is via your webpack configuration file....
Read more >
How to setup Webpack config - Arek Nawo
Parcel.js provides true out-of-the-box support for many different assets ... The importLoaders option for css-loader is indicating how many ...
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