Skip to content

Commit

Permalink
feat: allow gatsby plugin to see local plugins as entrypoints (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 authored and webpro committed Oct 7, 2023
1 parent 925e2f6 commit 85ffbc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/plugins/gatsby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ or `devDependencies`:
```json
{
"gatsby": {
"config": ["gatsby-{config,node}.{js,jsx,ts,tsx}"],
"config": ["gatsby-{config,node}.{js,jsx,ts,tsx}", "plugins/**/gatsby-node.{js,jsx,ts,tsx}"],
"entry": [
"gatsby-{browser,ssr}.{js,jsx,ts,tsx}",
"src/api/**/*.{js,ts}",
"src/pages/**/*.{js,jsx,ts,tsx}",
"src/templates/**/*.{js,jsx,ts,tsx}",
"src/html.{js,jsx,ts,tsx}"
"src/html.{js,jsx,ts,tsx}",
"plugins/**/gatsby-{browser,ssr}.{js,jsx,ts,tsx}"
]
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/gatsby/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export const ENABLERS = ['gatsby', 'gatsby-cli'];

export const isEnabled: IsPluginEnabledCallback = ({ dependencies }) => hasDependency(dependencies, ENABLERS);

export const CONFIG_FILE_PATTERNS = ['gatsby-{config,node}.{js,jsx,ts,tsx}'];
export const CONFIG_FILE_PATTERNS = [
'gatsby-{config,node}.{js,jsx,ts,tsx}',
'plugins/**/gatsby-node.{js,jsx,ts,tsx}',
];

/** @public */
export const PRODUCTION_ENTRY_FILE_PATTERNS = [
Expand All @@ -23,6 +26,7 @@ export const PRODUCTION_ENTRY_FILE_PATTERNS = [
'src/pages/**/*.{js,jsx,ts,tsx}',
'src/templates/**/*.{js,jsx,ts,tsx}',
'src/html.{js,jsx,ts,tsx}',
'plugins/**/gatsby-{browser,ssr}.{js,jsx,ts,tsx}',
];

const findGatsbyDependencies: GenericPluginCallback = async (configFilePath, { isProduction }) => {
Expand Down

0 comments on commit 85ffbc9

Please sign in to comment.