[App Extensibility ⚙️] Fix Babel configuration ignore node_modules folder adjusted for Windows (@W-17373534@)#2230
Merged
adamraya merged 11 commits intofeature/extensibility-v2from Jan 31, 2025
Conversation
alexvuong
reviewed
Jan 30, 2025
| ([packageName]) => | ||
| fse.realpathSync( | ||
| p.resolve(p.join(NODE_MODULES_PATH, packageName, 'src')) | ||
| ) + '/**' |
Contributor
There was a problem hiding this comment.
should this be \** in window?
kevinxh
reviewed
Jan 30, 2025
| // NOTE: Because our extensions are just folders containing source code, we need to ensure that the babel-loader processes them. | ||
| // This regex exclude everything in node_modules, but node_modules/extensions-*/ folders | ||
| exclude: /node_modules\/(?!(@?[^/]+\/)?extension-)[^/]+\/.*$/i, | ||
| exclude: /node_modules[\\/](?!(@?[^\\/]+[\\/])?extension-)[^\\/]+[\\/].*$/i, |
Contributor
There was a problem hiding this comment.
you could use path.sep to simplify this regex a bit...
new Regex(`${path.sep}`)
alexvuong
reviewed
Jan 30, 2025
| extensionSrcPaths.length > 0 ? `,${extensionSrcPaths.join(',')}` : '' | ||
|
|
||
| const babelArgs = `--only "app/**,${serverPath},${placeHolderPath}${extensionsPathsStr}"` | ||
| const babelArgs = `--only "app/**,${serverPath},${placeHolderPath}${extensionsPathsStr}"` |
alexvuong
approved these changes
Jan 30, 2025
alexvuong
approved these changes
Jan 31, 2025
kevinxh
reviewed
Jan 31, 2025
| if (/node_modules\/@[^/]+\/(pwa-kit-extension-sdk|extension-)/.test(filepath)) { | ||
| if ( | ||
| new RegExp( | ||
| `node_modules\\${path.sep}[^\\${path.sep}]+\\${path.sep}(pwa-kit-extension-sdk|@[^\\${path.sep}]+\\${path.sep}extension-|extension-)` |
Contributor
There was a problem hiding this comment.
nit, maybe it's worth saving this to a variable for re-use
kevinxh
approved these changes
Jan 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow up on PR #2228 by adjusting the Babel changes to ensure compatibility with Windows.
Adjusted Babel config to support Windows using backslashes
\and Unix-like systems using forward slashes/as path separators.Types of Changes
Changes
How to Test-Drive This PR
Checkout this branch
W-17373534-ignore-node_modules-windowson a Windows machine and runnpm ci.Run the generator with this configuration:
packages\extension-chakra-storefront\config\sample.jsoninto theextension-chakra-storefrontinside the generated projectpackage.jsonfile.Verify
Check previous PR to test on a Mac machine: #2228
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization