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: disable vite log filter #58

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,10 +1037,10 @@ export function resolveBuildOutputs(
}

const warningIgnoreList = [`CIRCULAR_DEPENDENCY`, `THIS_IS_UNDEFINED`]
const dynamicImportWarningIgnoreList = [
`Unsupported expression`,
`statically analyzed`,
]
// const dynamicImportWarningIgnoreList = [
// `Unsupported expression`,
// `statically analyzed`,
// ]

function clearLine() {
const tty = process.stdout.isTTY && !process.env.CI
Expand All @@ -1065,41 +1065,41 @@ export function onRollupWarning(
}

if (typeof warning === 'object') {
if (warning.code === 'UNRESOLVED_IMPORT') {
const id = warning.id
const exporter = warning.exporter
// throw unless it's commonjs external...
if (!id || !id.endsWith('?commonjs-external')) {
throw new Error(
`[vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n` +
`This is most likely unintended because it can break your application at runtime.\n` +
`If you do want to externalize this module explicitly add it to\n` +
`\`build.rollupOptions.external\``,
)
}
}
// if (warning.code === 'UNRESOLVED_IMPORT') {
// const id = warning.id
// const exporter = warning.exporter
// // throw unless it's commonjs external...
// if (!id || !id.endsWith('?commonjs-external')) {
// throw new Error(
// `[vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n` +
// `This is most likely unintended because it can break your application at runtime.\n` +
// `If you do want to externalize this module explicitly add it to\n` +
// `\`build.rollupOptions.external\``,
// )
// }
// }

if (
warning.plugin === 'rollup-plugin-dynamic-import-variables' &&
dynamicImportWarningIgnoreList.some((msg) =>
warning.message.includes(msg),
)
) {
return
}
// if (
// warning.plugin === 'rollup-plugin-dynamic-import-variables' &&
// dynamicImportWarningIgnoreList.some((msg) =>
// warning.message.includes(msg),
// )
// ) {
// return
// }

if (warningIgnoreList.includes(warning.code!)) {
return
}

if (warning.code === 'PLUGIN_WARNING') {
environment.logger.warn(
`${colors.bold(
colors.yellow(`[plugin:${warning.plugin}]`),
)} ${colors.yellow(warning.message)}`,
)
return
}
// if (warning.code === 'PLUGIN_WARNING') {
// environment.logger.warn(
// `${colors.bold(
// colors.yellow(`[plugin:${warning.plugin}]`),
// )} ${colors.yellow(warning.message)}`,
// )
// return
// }
}

warn(warnLog)
Expand Down
Loading