File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed
pwa-kit-extension-sdk/src/configs/babel Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,9 @@ export default {
6565
6666 // Return false if it's an allowed extension package @salesforce/pwa-kit-extension-sdk and extension-*
6767 if (
68- / n o d e _ m o d u l e s [ \\ / ] [ ^ / ] + [ \\ / ] ( p w a - k i t - e x t e n s i o n - s d k | @ [ ^ / ] + \/ e x t e n s i o n - | e x t e n s i o n - ) / . test (
69- normalizedPath
70- )
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 )
7171 ) {
7272 return false
7373 }
Original file line number Diff line number Diff line change 99
1010// For more information on these settings, see https://webpack.js.org/configuration
1111import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
12- import { resolve } from 'path'
12+ import path , { resolve } from 'path'
1313import fse from 'fs-extra'
1414import webpack from 'webpack'
1515
@@ -341,7 +341,10 @@ const ruleForBabelLoader = (babelPlugins) => {
341341 test : / ( \. j s ( x ? ) | \. t s ( x ? ) ) $ / ,
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
344- exclude : / n o d e _ m o d u l e s [ \\ / ] (? ! ( @ ? [ ^ \\ / ] + [ \\ / ] ) ? e x t e n s i o n - ) [ ^ \\ / ] + [ \\ / ] .* $ / i,
344+ exclude : new RegExp (
345+ `node_modules\\${ path . sep } (?!(@?[^\\${ path . sep } ]+\\${ path . sep } )?extension-).*` ,
346+ 'i'
347+ ) ,
345348 use : [
346349 {
347350 loader : findDepInStack ( 'babel-loader' ) ,
Original file line number Diff line number Diff line change @@ -49,21 +49,22 @@ 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' , '**' )
5253
5354 const extensionSrcPaths =
5455 extensions . length > 0
55- ? extensions . map (
56- ( [ packageName ] ) =>
57- fse . realpathSync (
58- p . resolve ( p . join ( NODE_MODULES_PATH , packageName , 'src' ) )
59- ) + '/ **'
60- )
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+ } )
6162 : [ ]
6263
6364 const extensionsPathsStr =
6465 extensionSrcPaths . length > 0 ? `,${ extensionSrcPaths . join ( ',' ) } ` : ''
6566
66- const babelArgs = `--only "app/** ,${ serverPath } ,${ placeHolderPath } ${ extensionsPathsStr } " `
67+ const babelArgs = `--only ${ appPath } ,${ serverPath } ,${ placeHolderPath } ${ extensionsPathsStr } `
6768
6869 return babelArgs
6970 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments