Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not fail if the location of a warning is outside the original sour…
…ce (#4922) * Do not fail if the location of a warning is outside the original source * Fix comparison
- Loading branch information
1 parent
b6c4fd8
commit 1517d03
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
test/function/samples/warning-incorrect-sourcemap-location/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const { join } = require('node:path'); | ||
const ID_MAIN = join(__dirname, 'main.js'); | ||
const ID_CONSTANTS = join(__dirname, 'constants.js'); | ||
|
||
module.exports = { | ||
description: 'does not fail if a warning has an incorrect location due to missing sourcemaps', | ||
options: { | ||
plugins: [ | ||
{ | ||
name: 'test', | ||
transform(code) { | ||
return '/* injected */;\n\n\n\n\n\n\n\n' + code; | ||
} | ||
} | ||
] | ||
}, | ||
warnings: [ | ||
{ | ||
binding: 'NON_EXISTENT', | ||
code: 'MISSING_EXPORT', | ||
exporter: ID_CONSTANTS, | ||
frame: '', | ||
id: ID_MAIN, | ||
loc: { | ||
column: 15, | ||
file: ID_MAIN, | ||
line: 12 | ||
}, | ||
message: '"NON_EXISTENT" is not exported by "constants.js", imported by "main.js".', | ||
pos: 111, | ||
url: 'https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module' | ||
} | ||
] | ||
}; |
1 change: 1 addition & 0 deletions
1
test/function/samples/warning-incorrect-sourcemap-location/constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const q = 'Queue'; |
5 changes: 5 additions & 0 deletions
5
test/function/samples/warning-incorrect-sourcemap-location/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as CONSTANTS from './constants'; | ||
|
||
export default class Sample { | ||
x = CONSTANTS.NON_EXISTENT; | ||
} |