Installations
npm install relay-compiler-webpack-plugin
Developer
danielholmes
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
NPM Version
Statistics
65 Stars
256 Commits
35 Forks
4 Watching
15 Branches
29 Contributors
Updated on 25 Aug 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
709,896
Last day
-6.2%
256
Compared to previous day
Last week
-8.3%
1,426
Compared to previous week
Last month
-28%
12,399
Compared to previous month
Last year
134.7%
136,049
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
3
Dev Dependencies
34
Relay Compiler Webpack Plugin
Are you running Relay Modern? Are you annoyed with constantly running the relay-compiler
to generate code, especially
if you're already running Webpack?
Well be annoyed no more! Simply install this plugin to automatically hook into Webpack's build process to generate these files for you.
Installation
- Add this to your project:
1 yarn add --dev relay-compiler-webpack-plugin graphql 2 # Or if you're using npm 3 npm install --save-dev relay-compiler-webpack-plugin graphql
- Add the plugin to your Webpack configuration:
1// const RelayCompilerLanguageTypescript = require('relay-compiler-language-typescript').default 2const RelayCompilerWebpackPlugin = require('relay-compiler-webpack-plugin') 3const path = require('path') 4 5module.exports = { 6 // ... Your existing Webpack configuration 7 plugins: [ 8 // ... 9 new RelayCompilerWebpackPlugin({ 10 // languagePlugin: RelayCompilerLanguageTypescript, 11 schema: path.resolve(__dirname, './relative/path/to/schema.graphql'), // or schema.json 12 src: path.resolve(__dirname, './relative/path/to/source/files'), 13 }) 14 ] 15 // ... 16}
Note: TypeScript projects also needs to add the TypeScript language plugin as shown in the commented out lines in the above snippet.
- :tada:
Gotchas
If there are multiple versions of GraphQL in your dependency tree it will cause schema validation errors. To get around this, ensure you have the same graphql version as your relay-compiler version depends on. To assist this you can install dependencies as flat which ensures only one version of each dependency.
Plugin hooks
relay-compiler-webpack-plugin
exposes a few tapable hooks, for plugins or tooling to use.
beforeWrite
called before the plugin starts to compile queriesafterWrite(compileResult)
: called after writing is complete
1class MyPlugin { 2 apply (compiler) { 3 compiler.hooks.compilation.tap('MyPlugin', async (compilation) => { 4 RelayCompilerWebpackPlugin.getHooks(compilation).afterWrite.tapPromise( 5 'MyPlugin', // <-- Set a meaningful name for stacktraces 6 async (compileResult) => { 7 if (compileResult === 'HAS_CHANGES') { 8 await doSomething() 9 } 10 } 11 ) 12 }) 13 } 14}
Example Project
To see an example of its usage within a project, see relay-compiler-webpack-plugin-example.
Development
Running tests:
1yarn test
Running tests with coverage:
1yarn test:coverage
License
Relay Compiler Webpack Plugin may be redistributed according to the BSD 3-Clause License.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: BSD 3-Clause "New" or "Revised" License: LICENSE:0
Reason
Found 2/18 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/build.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/relay-tools/relay-compiler-webpack-plugin/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/relay-tools/relay-compiler-webpack-plugin/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/relay-tools/relay-compiler-webpack-plugin/build.yml/master?enable=pin
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
- Warn: branch protection not enabled for branch '2.0.0'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 14 are checked with a SAST tool
Reason
40 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
2.6
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to relay-compiler-webpack-plugin
@ch1ffa/relay-compiler-webpack-plugin
Webpack pluging for running relay-compiler in webpack dev mode
relay-compiler
A compiler tool for building GraphQL-driven applications.
@ngtools/webpack
Webpack plugin that AoT compiles your Angular components and modules.
relay-compiler-language-typescript
A language plugin for Relay that adds TypeScript support, including emitting type definitions.