From 1320f02b24a899a3acf8e45ec9efbb6ed4336e92 Mon Sep 17 00:00:00 2001 From: chenxsan Date: Tue, 20 Sep 2022 21:57:48 +0800 Subject: [PATCH] docs(guides): add emit section for asset modules --- src/content/guides/asset-modules.mdx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/content/guides/asset-modules.mdx b/src/content/guides/asset-modules.mdx index ede35935412d..0b47ba63a3d2 100644 --- a/src/content/guides/asset-modules.mdx +++ b/src/content/guides/asset-modules.mdx @@ -472,3 +472,24 @@ module: { ] }, ``` + +## Disable emitting assets + +For use cases like Server side rendering, you might want to disable emitting assets, which is feasible with [`emit`](/configuration/module/#rulegeneratoremit) option under `Rule.generator`: + +```js +module.exports = { + // … + module: { + rules: [ + { + test: /\.png$/i, + type: 'asset/resource', + generator: { + emit: false, + }, + }, + ], + }, +}; +```