Skip to content

Commit

Permalink
Revert "chore: show error position (vitejs#13623)"
Browse files Browse the repository at this point in the history
This reverts commit 90271a6.
  • Loading branch information
ailadas authored Jun 25, 2023
1 parent 90271a6 commit fb4b2e8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
15 changes: 2 additions & 13 deletions packages/vite/src/node/plugins/importAnalysisBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import {
bareImportRE,
cleanUrl,
combineSourcemaps,
generateCodeFrame,
isDataUrl,
isExternalUrl,
isInNodeModules,
moduleListContains,
numberToPos,
} from '../utils'
import type { Plugin } from '../plugin'
import { getDepOptimizationConfig } from '../config'
Expand Down Expand Up @@ -223,7 +221,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
try {
imports = parseImports(source)[0]
} catch (e: any) {
this.error(e, e.idx)
this.error(e)
}

if (!imports.length) {
Expand Down Expand Up @@ -464,16 +462,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
try {
imports = parseImports(code)[0].filter((i) => i.d > -1)
} catch (e: any) {
const loc = numberToPos(code, e.idx)
this.error({
name: e.name,
message: e.message,
stack: e.stack,
cause: e.cause,
pos: e.idx,
loc: { ...loc, file: chunk.fileName },
frame: generateCodeFrame(code, loc),
})
this.error(e)
}

const s = new MagicString(code)
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/pluginContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export async function createPluginContainer(
// active plugin in that pipeline can be tracked in a concurrency-safe manner.
// using a class to make creating new contexts more efficient
class Context implements PluginContext {
meta = minimalContext.meta
meta = minimalContext.meta!
ssr = false
_scan = false
_activePlugin: Plugin | null
Expand Down
18 changes: 2 additions & 16 deletions packages/vite/src/node/ssr/ssrManifestPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ import jsonStableStringify from 'json-stable-stringify'
import type { ResolvedConfig } from '..'
import type { Plugin } from '../plugin'
import { preloadMethod } from '../plugins/importAnalysisBuild'
import {
generateCodeFrame,
joinUrlSegments,
normalizePath,
numberToPos,
} from '../utils'
import { joinUrlSegments, normalizePath } from '../utils'

export function ssrManifestPlugin(config: ResolvedConfig): Plugin {
// module id => preload assets mapping
Expand Down Expand Up @@ -47,16 +42,7 @@ export function ssrManifestPlugin(config: ResolvedConfig): Plugin {
try {
imports = parseImports(code)[0].filter((i) => i.n && i.d > -1)
} catch (e: any) {
const loc = numberToPos(code, e.idx)
this.error({
name: e.name,
message: e.message,
stack: e.stack,
cause: e.cause,
pos: e.idx,
loc: { ...loc, file: chunk.fileName },
frame: generateCodeFrame(code, loc),
})
this.error(e)
}
if (imports.length) {
for (let index = 0; index < imports.length; index++) {
Expand Down

0 comments on commit fb4b2e8

Please sign in to comment.