diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index 08a2536b63d87..2a40d217c6701 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -290,7 +290,7 @@ module.exports = async ( ] const isFramework = some( vendorModuleList.map(vendor => { - const regex = new RegExp(`/node_modules/${vendor}/.*`, `i`) + const regex = new RegExp(`[\\\\/]node_modules[\\\\/]${vendor}[\\\\/].*`, `i`) return regex.test(module.resource) }) )