File tree Expand file tree Collapse file tree 3 files changed +13
-14
lines changed
pwa-kit-extension-sdk/src/configs/babel Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -63,12 +63,12 @@ export default {
6363 function ( filepath ) {
6464 const normalizedPath = path . normalize ( filepath )
6565
66+ const extensionRegex = new RegExp (
67+ `node_modules${ path . sep } [^${ path . sep } ]+${ path . sep } (pwa-kit-extension-sdk|@[^${ path . sep } ]+${ path . sep } extension-|extension-)`
68+ )
69+
6670 // Return false if it's an allowed extension package @salesforce/pwa-kit-extension-sdk and extension-*
67- if (
68- new RegExp (
69- `node_modules\\${ path . sep } [^\\${ path . sep } ]+\\${ path . sep } (pwa-kit-extension-sdk|@[^\\${ path . sep } ]+\\${ path . sep } extension-|extension-)`
70- ) . test ( normalizedPath )
71- ) {
71+ if ( extensionRegex . test ( normalizedPath ) ) {
7272 return false
7373 }
7474
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ const ruleForBabelLoader = (babelPlugins) => {
342342 // NOTE: Because our extensions are just folders containing source code, we need to ensure that the babel-loader processes them.
343343 // This regex exclude everything in node_modules, but node_modules/extensions-*/ folders
344344 exclude : new RegExp (
345- `node_modules\\ ${ path . sep } (?!(@?[^\\ ${ path . sep } ]+\\ ${ path . sep } )?extension-).*` ,
345+ `node_modules${ path . sep } (?!(@?[^${ path . sep } ]+${ path . sep } )?extension-).*` ,
346346 'i'
347347 ) ,
348348 use : [
Original file line number Diff line number Diff line change @@ -49,22 +49,21 @@ export const buildBabelExtensibilityArgs = (config: any) => {
4949 const extensions = getConfiguredExtensions ( config )
5050 const serverPath = fse . realpathSync ( p . resolve ( SERVER_PATH ) )
5151 const placeHolderPath = fse . realpathSync ( p . resolve ( PLACEHOLDER_PATH ) )
52- const appPath = p . join ( 'app' , '**' )
5352
5453 const extensionSrcPaths =
5554 extensions . length > 0
56- ? extensions . map ( ( [ packageName ] ) => {
57- const realPath = fse . realpathSync (
58- p . resolve ( p . join ( NODE_MODULES_PATH , packageName , 'src' ) )
59- )
60- return p . join ( realPath , '**' )
61- } )
55+ ? extensions . map (
56+ ( [ packageName ] ) =>
57+ fse . realpathSync (
58+ p . resolve ( p . join ( NODE_MODULES_PATH , packageName , 'src' ) )
59+ ) + ` ${ p . sep } **`
60+ )
6261 : [ ]
6362
6463 const extensionsPathsStr =
6564 extensionSrcPaths . length > 0 ? `,${ extensionSrcPaths . join ( ',' ) } ` : ''
6665
67- const babelArgs = `--only "${ appPath } ,${ serverPath } ,${ placeHolderPath } ${ extensionsPathsStr } "`
66+ const babelArgs = `--only "${ `app ${ p . sep } **` } ,${ serverPath } ,${ placeHolderPath } ${ extensionsPathsStr } "`
6867
6968 return babelArgs
7069 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments