Skip to content

[plugin:vite:import-analysis] Failed to resolve import "/public/empty.png" #109

@GuoChen-thlg

Description

@GuoChen-thlg

Using the custom function $require('/public/empty.png') in a template throws the error [plugin:vite:import-analysis] Parsing the imported "/public/ empty.png" fails

var render = function render(){var _vm=this,_c=_vm._self._c;return _c('el-popover',{attrs:{"placement":"right-end","width":"650","trigger":"hover"}},[_c('img',{staticClass:"mb_bg_no_img",attrs:{"src":_vm.$require('/public/mb_bg_notice.png'),"alt":""}}),(!_vm.isSpecial)?_c('span',{staticClass:"commonBtn advice",attrs:{"slot":"reference"},slot:"reference"},[_vm._v("查看尺寸说明")]):(_vm.isSpecial)?_c('span',{staticClass:"commonBtn advice",staticStyle:{"color":"rgba(5,27,54,0.45)"},attrs:{"slot":"reference"},slot:"reference"},[_vm._v("尺寸说明"),_c('img',{staticStyle:{"width":"16px","height":"16px","margin-bottom":"2px","margin-left":"4px"},attrs:{"src":_vm.$require('/base/invite_activity/question-griy.png'),"alt":"","srcset":""}})]):_vm._e()])\n}\nvar staticRenderFns = []\nrender._withStripped = true

transformRequireToImport accidentally parses this code with the custom function $require as require.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions