Support writing configuration as webpack Loader option
See original GitHub issueFrom 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:
- .graphql-let.yml
- CWD is where the
.graphql-let.yml
is located
- CWD is where the
- webpack Loader option
- If the paths are absolute, it respects as is
- If the paths are relative, it recognizes config.context as CWD
- .graphql-let.yml
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi. True, it should be like the Babel’s
configFile
option, wherebabel-loader
can pass all babel options OR a relative path to a config file. And yes, accepting aconfigFilePath
option would be our first step.The problem would be, graphql-let currently expects both
.graphql-let.yml
andwebpackConfig.context
are inprocess.cwd()
. So the PR solving is supposed to have tests with changing these paths.I encountered two problems while using graphql-let in a Nx monorepo.
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 withoptions.configFile
accepting a path to the config.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
(productioncontext
) instead of<root-dir>/path/to/file.gql
where TypeScript expects them. This could be fixed byoptions.configFile
accepting full config orrootDir
andcacheDir
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