diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index adfb44c1..aa4efd86 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -26,16 +26,16 @@ body: attributes: label: Reproduction description: | - How can we reproduce the issue? When an issue is immediately reproducible, others can start debugging instead of following-up with questions. - placeholder: | - + Provide a link to a minimal reproduction repository: + - Set the command to run in the `package.json` script `start` + - For a starter template, [fork this template on StackBlitz](https://stackblitz.com/edit/node-guv65j?file=webpack.config.js&view=editor) + - No more than 10 files. Delete irrelevant files (e.g. `LICENSE`, `.npmrc`, `.github`). This is the first step of debugging so doing this will save us work. + 👉 **Tip:** The _smaller_ the reproduction, the _faster_ we can debug and resolve your issue + + ⚠️ If a _minimal_ reproduction is not provided, the issue will be closed + placeholder: 👆 Your issue will be CLOSED if it doesn't follow the instructions above. validations: required: true - type: dropdown @@ -52,7 +52,12 @@ body: attributes: label: Environment description: | - Describe the environment the issue is happening in. This information is used to for reproduction and debugging. Run and paste the output of: `npx envinfo --system --npmPackages webpack,esbuild-loader --binaries`. + Run and paste the output of: + ``` + npx envinfo --system --npmPackages webpack,esbuild-loader --binaries + ``` + + This information is used to for reproduction and debugging. placeholder: | System: OS: diff --git a/src/plugin.ts b/src/plugin.ts index b769dac1..88bc1e25 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -56,18 +56,20 @@ const transformAssets = async ( const assetIsCss = isCssFile.test(asset.name); let source: string | Buffer | ArrayBuffer; let map = null; - - if (asset.source.sourceAndMap) { - const sourceAndMap = asset.source.sourceAndMap(); - source = sourceAndMap.source; - map = sourceAndMap.map; + if (useSourceMap) { + if (asset.source.sourceAndMap) { + const sourceAndMap = asset.source.sourceAndMap(); + source = sourceAndMap.source; + map = sourceAndMap.map; + } else { + source = asset.source.source(); + if (asset.source.map) { + map = asset.source.map(); + } + } } else { source = asset.source.source(); - if (asset.source.map) { - map = asset.source.map(); - } } - const sourceAsString = source.toString(); const result = await transform(sourceAsString, { ...transformOptions,