Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #8500 by not adding offset to line numbers #8501

Merged
merged 1 commit into from
Nov 5, 2022

Conversation

lol768
Copy link
Contributor

@lol768 lol768 commented Sep 23, 2022

Closes #8500

Code snippet previews work after applying this patch, and the line numbers make sense again:

image

@mischnic
Copy link
Member

Can you add a test case to https://github.com/parcel-bundler/parcel/blob/v2/packages/core/integration-tests/test/vue.js for this example?

So duplicate https://github.com/parcel-bundler/parcel/tree/v2/packages/core/integration-tests/test/integration/vue-basic and make it fail with an error like in your screenshot, then add an assertion like this one

it('should throw a codeframe for a missing file in serviceWorker.register with URL and import.meta.url', async function () {
let fixture = path.join(
__dirname,
'integration/service-worker-import-meta-url/missing.js',
);
let code = await inputFS.readFileSync(fixture, 'utf8');
await assert.rejects(() => bundle(fixture), {
name: 'BuildError',
diagnostics: [
{
codeFrames: [
{
filePath: fixture,
code,
codeHighlights: [
{
end: {
column: 55,
line: 1,
},
start: {
column: 42,
line: 1,
},
},
],
},
],
message: "Failed to resolve './invalid.js' from './missing.js'",
origin: '@parcel/core',
},
{
hints: ["Did you mean '__./index.js__'?"],
message: "Cannot load file './invalid.js' in './'.",
origin: '@parcel/resolver-default',
},
],
});
});

@devongovett devongovett merged commit cf3a752 into parcel-bundler:v2 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VueTransformer uses nonsensical values for codeFrames.codeHighlights line numbers
3 participants