Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:esbuild-kit/esbuild-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Feb 14, 2023
2 parents c92153c + 5c97454 commit e81aaa8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
25 changes: 15 additions & 10 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 one of the following:
1. A code-snippet that reproduces the issue
2. A reproduction repository that reproduces the issue
3. A pull request with a failing test-case
A minimal reproduction is necessary so others can understand and debug your bug.
Please remove as much irrelevant code to make it easier for others to read and debug.
-->
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
Expand All @@ -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:
Expand Down
20 changes: 11 additions & 9 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e81aaa8

Please sign in to comment.