{"record":{"id":"da2d2a8300b8ae9b","repo":"parcel-bundler/parcel","slug":"vue-config-should-be-an-object","errorCode":null,"errorMessage":"Vue config should be an object.","messagePattern":"Vue config should be an object\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/transformers/vue/src/VueTransformer.js","lineNumber":45,"sourceCode":"      [\n        '.vuerc',\n        '.vuerc.json',\n        '.vuerc.js',\n        '.vuerc.cjs',\n        '.vuerc.mjs',\n        'vue.config.js',\n        'vue.config.cjs',\n        'vue.config.mjs',\n      ],\n      {packageKey: 'vue'},\n    );\n    let contents = {};\n    if (conf) {\n      config.invalidateOnStartup();\n      contents = conf.contents;\n      if (typeof contents !== 'object') {\n        // TODO: codeframe\n        throw new ThrowableDiagnostic({\n          diagnostic: {\n            message: 'Vue config should be an object.',\n            origin: '@parcel/transformer-vue',\n          },\n        });\n      }\n    }\n    return {\n      customBlocks: contents.customBlocks || {},\n      filePath: conf && conf.filePath,\n      compilerOptions: contents.compilerOptions || {},\n    };\n  },\n  canReuseAST({ast}) {\n    return ast.type === 'vue' && semver.satisfies(ast.version, '^3.0.0');\n  },\n  async parse({asset, options}) {\n    // TODO: This parses the vue component multiple times. Fix?","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/transformers/vue/src/VueTransformer.js#L27-L63","documentation":"Thrown by @parcel/transformer-vue when a discovered vue.config.{js,cjs,mjs} file exports a value whose typeof is not 'object'. The transformer expects a plain configuration object (customBlocks, compilerOptions); any other shape (string, number, array, function without return) is rejected before reading keys.","triggerScenarios":"Parcel resolves a vue config file via the packageKey 'vue' or one of the well-known filenames, then checks typeof conf.contents. A module-default-exported string, a named export misread, or `export default []` triggers it.","commonSituations":"Author writes `module.exports = 'something'` instead of an object, uses `export default function()` (function, not object), or the config file is actually a CommonJS file loaded in a way that yields module.exports = string. Also happens when a build tool rewrites the export into a non-object.","solutions":["Ensure vue.config.js exports a plain object: `module.exports = { compilerOptions: {...} }`.","If using ESM, write `export default { compilerOptions: {} };`.","Remove the vue.config file if no custom compiler options are needed.","Verify the file is not accidentally exporting the result of a function call that returns a non-object."],"exampleFix":"// before: module.exports = 'production';\n// after:  module.exports = { compilerOptions: { whitespace: 'condense' } };","handlingStrategy":"type-guard","validationCode":"import conf from './vue.config';\nif (conf !== null && typeof conf !== 'object' || Array.isArray(conf)) {\n  throw new Error('vue.config must export a plain object');\n}","typeGuard":"function isVueConfig(v) {\n  return v !== null && typeof v === 'object' && !Array.isArray(v);\n}","tryCatchPattern":null,"preventionTips":["Always export a plain object literal from vue.config.js.","Avoid `export default function()` unless you immediately invoke and return an object.","Lint config files to reject non-object default exports."],"tags":["vue","config","parcel-transformer","validation"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}