File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 11// WARNING: be careful not to import `esbuild` within next
2- import type { BuildOptions } from 'esbuild'
2+ import { type BuildOptions } from 'esbuild'
33
44export function getEsbuildConfig ( cwd : string ) : BuildOptions {
5+ try {
6+ return require ( require . resolve ( `${ cwd } /esbuild.keystone.js` ) )
7+ } catch ( e ) { }
8+
9+ // default fallback
510 return {
611 entryPoints : [ './keystone' ] ,
712 absWorkingDir : cwd ,
@@ -17,16 +22,12 @@ export function getEsbuildConfig (cwd: string): BuildOptions {
1722 setup ( build ) {
1823 build . onResolve (
1924 {
20- // this regex is intended to be the opposite of /^\.\.?(?:\/|$)/
21- // so it matches anything that isn't a relative import
22- // so this means that we're only going to bundle relative imports
23- // we can't use a negative lookahead/lookbehind because this regex is executed
24- // by Go's regex package which doesn't support them
25- // this regex could have less duplication with nested groups but this is probably easier to read
25+ // don't bundle anything that is NOT a relative import
26+ // WARNING: we can't use a negative lookahead/lookbehind because esbuild uses Go
2627 filter : / (?: ^ [ ^ . ] ) | (?: ^ \. [ ^ / . ] ) | (?: ^ \. \. [ ^ / ] ) / ,
2728 } ,
28- args => {
29- return { external : true , path : args . path }
29+ ( { path } ) => {
30+ return { external : true , path }
3031 }
3132 )
3233 } ,
You can’t perform that action at this time.
0 commit comments