-
Notifications
You must be signed in to change notification settings - Fork 212
[App Extensibility ⚙️] Fix Babel configuration ignore node_modules folder adjusted for Windows (@W-17373534@)
#2230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
16e5aac
86e18be
ac9a185
84ef757
ce80e4c
61f9832
8147c45
990ab93
b31327e
4c62ee7
0972f26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,22 @@ import {getConfiguredExtensions} from '../../shared/utils' | |
| * if no actual extensions are added. | ||
| */ | ||
| const NODE_MODULES_PATH = 'node_modules' | ||
| const SERVER_PATH = `${NODE_MODULES_PATH}/@salesforce/pwa-kit-runtime/ssr/server/build-remote-server.js` | ||
| const PLACEHOLDER_PATH = `${NODE_MODULES_PATH}/@salesforce/pwa-kit-extension-sdk/express/placeholders/application-extensions.js` | ||
| const SERVER_PATH = p.join( | ||
| NODE_MODULES_PATH, | ||
| '@salesforce', | ||
| 'pwa-kit-runtime', | ||
| 'ssr', | ||
| 'server', | ||
| 'build-remote-server.js' | ||
| ) | ||
| const PLACEHOLDER_PATH = p.join( | ||
| NODE_MODULES_PATH, | ||
| '@salesforce', | ||
| 'pwa-kit-extension-sdk', | ||
| 'express', | ||
| 'placeholders', | ||
| 'application-extensions.js' | ||
| ) | ||
|
|
||
| /** | ||
| * Builds Babel extensibility arguments for processing specific files and paths. | ||
|
|
@@ -31,21 +45,29 @@ const PLACEHOLDER_PATH = `${NODE_MODULES_PATH}/@salesforce/pwa-kit-extension-sdk | |
| * or symlinked paths that Babel doesn't support by using realpathSync. | ||
| */ | ||
| export const buildBabelExtensibilityArgs = (config: any) => { | ||
| const extensions = getConfiguredExtensions(config) | ||
| const serverPath = fse.realpathSync(p.resolve(SERVER_PATH)) | ||
| const placeHolderPath = fse.realpathSync(p.resolve(PLACEHOLDER_PATH)) | ||
| try { | ||
| const extensions = getConfiguredExtensions(config) | ||
| const serverPath = fse.realpathSync(p.resolve(SERVER_PATH)) | ||
| const placeHolderPath = fse.realpathSync(p.resolve(PLACEHOLDER_PATH)) | ||
|
|
||
| const extensionSrcPaths = | ||
| extensions.length > 0 | ||
| ? extensions.map( | ||
| ([packageName]) => | ||
| fse.realpathSync(p.resolve(`${NODE_MODULES_PATH}/${packageName}/src`)) + '/**' | ||
| ) | ||
| : [] | ||
| const extensionSrcPaths = | ||
| extensions.length > 0 | ||
| ? extensions.map( | ||
| ([packageName]) => | ||
| fse.realpathSync( | ||
| p.resolve(p.join(NODE_MODULES_PATH, packageName, 'src')) | ||
| ) + '/**' | ||
|
||
| ) | ||
| : [] | ||
|
|
||
| const extensionsPathsStr = extensionSrcPaths.length > 0 ? `,${extensionSrcPaths.join(',')}` : '' | ||
| const extensionsPathsStr = | ||
| extensionSrcPaths.length > 0 ? `,${extensionSrcPaths.join(',')}` : '' | ||
|
|
||
| const babelArgs = `--only "app/**,${serverPath},${placeHolderPath}${extensionsPathsStr}"` | ||
| const babelArgs = `--only "app/**,${serverPath},${placeHolderPath}${extensionsPathsStr}"` | ||
|
||
|
|
||
| return babelArgs | ||
| return babelArgs | ||
| } catch (error) { | ||
| console.error('Error building Babel extensibility arguments:', error) | ||
| throw error | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use path.sep to simplify this regex a bit...