File tree 1 file changed +7
-1
lines changed
packages/runtime/src/helpers
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,12 @@ export const hasManuallyAddedModule = ({
96
96
)
97
97
/* eslint-enable camelcase */
98
98
99
+ /**
100
+ * Transforms `/api/shows/[id].js` into `/api/shows/*id*.js`,
101
+ * so that the file `[id].js` is matched correctly.
102
+ */
103
+ const escapeGlob = ( path : string ) => path . replace ( / \[ / g, '*' ) . replace ( / ] / g, '*' )
104
+
99
105
export const configureHandlerFunctions = async ( {
100
106
netlifyConfig,
101
107
publish,
@@ -173,7 +179,7 @@ export const configureHandlerFunctions = async ({
173
179
netlifyConfig . functions [ functionName ] ||= { included_files : [ ] }
174
180
netlifyConfig . functions [ functionName ] . node_bundler = 'none'
175
181
netlifyConfig . functions [ functionName ] . included_files ||= [ ]
176
- netlifyConfig . functions [ functionName ] . included_files . push ( ...includedFiles )
182
+ netlifyConfig . functions [ functionName ] . included_files . push ( ...includedFiles . map ( escapeGlob ) )
177
183
}
178
184
} else {
179
185
configureFunction ( '_api_*' )
You can’t perform that action at this time.
0 commit comments