@@ -24,7 +24,7 @@ import webpack from 'webpack';
24
24
import nodeExternals from 'webpack-node-externals' ;
25
25
import { optimization } from './optimization' ;
26
26
import { Config } from '@backstage/config' ;
27
- import { BundlingPaths } from './paths' ;
27
+ import { BundlingPaths , isChildPath } from './paths' ;
28
28
import { transforms } from './transforms' ;
29
29
import { LinkedPackageResolvePlugin } from './LinkedPackageResolvePlugin' ;
30
30
import { BundlingOptions , BackendBundlingOptions , LernaPackage } from './types' ;
@@ -87,7 +87,9 @@ export async function createConfig(
87
87
const { plugins, loaders } = transforms ( options ) ;
88
88
// Any package that is part of the monorepo but outside the monorepo root dir need
89
89
// separate resolution logic.
90
- const externalPkgs = packages . filter ( p => ! p . location . startsWith ( paths . root ) ) ;
90
+ const externalPkgs = packages . filter (
91
+ p => ! isChildPath ( paths . root , p . location ) ,
92
+ ) ;
91
93
92
94
const baseUrl = frontendConfig . getString ( 'app.baseUrl' ) ;
93
95
const validBaseUrl = new URL ( baseUrl ) ;
@@ -199,7 +201,9 @@ export async function createBackendConfig(
199
201
const moduleDirs = packages . map ( ( p : any ) =>
200
202
resolvePath ( p . location , 'node_modules' ) ,
201
203
) ;
202
- const externalPkgs = packages . filter ( p => ! p . location . startsWith ( paths . root ) ) ; // See frontend config
204
+ const externalPkgs = packages . filter (
205
+ p => ! isChildPath ( paths . root , p . location ) ,
206
+ ) ; // See frontend config
203
207
204
208
const { loaders } = transforms ( options ) ;
205
209
0 commit comments