diff --git a/package.json b/package.json index b1a7f46df6c0..ca5dba3d1a03 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "remark-refractor": "montogeek/remark-refractor", "remark-slug": "^6.1.0", "rimraf": "^3.0.2", - "sass": "^1.39.2", + "sass": "^1.57.1", "sass-loader": "^12.1.0", "sirv-cli": "^1.0.14", "sitemap-static": "^0.4.2", diff --git a/src/content/plugins/normal-module-replacement-plugin.mdx b/src/content/plugins/normal-module-replacement-plugin.mdx index 6e7d9cecc6c2..56d946c40280 100644 --- a/src/content/plugins/normal-module-replacement-plugin.mdx +++ b/src/content/plugins/normal-module-replacement-plugin.mdx @@ -4,6 +4,7 @@ group: webpack contributors: - gonzoyumo - byzyk + - chenxsan --- The `NormalModuleReplacementPlugin` allows you to replace resources that match `resourceRegExp` with `newResource`. If `newResource` is relative, it is resolved relative to the previous resource. If `newResource` is a function, it is expected to overwrite the request attribute of the supplied resource. @@ -14,6 +15,8 @@ This can be useful for allowing different behaviour between builds. new webpack.NormalModuleReplacementPlugin(resourceRegExp, newResource); ``` +Note that the `resourceRegExp` is tested against the request you write in your code, not the resolved resource. For instance, `'./sum'` will be used to test instead of `./sum.js` when you have code `import sum from './sum'`. + ## Basic Example Replace a specific module when building for a [development environment](/guides/production). diff --git a/yarn.lock b/yarn.lock index 87feccfc03ef..507376803016 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6399,6 +6399,11 @@ imageinfo@^1.0.4: resolved "https://registry.yarnpkg.com/imageinfo/-/imageinfo-1.0.4.tgz#1dd2456ecb96fc395f0aa1179c467dfb3d5d7a2a" integrity sha1-HdJFbsuW/DlfCqEXnEZ9+z1deio= +immutable@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef" + integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ== + import-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-3.0.0.tgz#20845547718015126ea9b3676b7592fb8bd4cf92" @@ -10720,12 +10725,14 @@ sass-loader@^12.1.0: klona "^2.0.4" neo-async "^2.6.2" -sass@^1.39.2: - version "1.39.2" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.39.2.tgz#1681964378f58d76fc64a6a502619bd5ac99f660" - integrity sha512-4/6Vn2RPc+qNwSclUSKvssh7dqK1Ih3FfHBW16I/GfH47b3scbYeOw65UIrYG7PkweFiKbpJjgkf5CV8EMmvzw== +sass@^1.57.1: + version "1.57.1" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.57.1.tgz#dfafd46eb3ab94817145e8825208ecf7281119b5" + integrity sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw== dependencies: chokidar ">=3.0.0 <4.0.0" + immutable "^4.0.0" + source-map-js ">=0.6.2 <2.0.0" sax@>=0.6.0, sax@~1.2.4: version "1.2.4" @@ -11062,6 +11069,11 @@ source-list-map@^2.0.0: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== +"source-map-js@>=0.6.2 <2.0.0": + version "1.0.2" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== + source-map-js@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e"