Skip to content

require('@/assets/images'+module.icon)转换结果缺少换行符 #57

Description

@touch-xzc

环境:
vite: 5.4.0;
vue: 2.7;
@vitejs/plugin-vue2: 2.3.1;
vite-plugin-commonjs: 0.10.1

代码:
<el-badge :value="myTaskCounts" class="badgeItem" type="danger" v-if="module.id == 0">
<img :src="require('@/assets/images'+module.icon)" alt="Module Icon">
</el-badge>

报错:
vite v5.4.0 building for production...
✓ 7 modules transformed.
x Build failed in 2.50s
error during build:
[commonjs--resolver] Expected ';', got 'matchRequireRuntime0' in D:/ideaWork/svn/打包工具替换/ruoyi-ui/src/views/myapp.vue
file: D:/ideaWork/svn/打包工具替换/ruoyi-ui/src/views/myapp.vue:138:45

136: null
137: )
138: export default component.exportsfunction matchRequireRuntime0(path) {
^
139: switch(path) {

vite-plugin-commonjs转换前:
xxxx
export default component.exports

vite-plugin-commonjs转换后:
xxxx
export default component.exportsfunction
matchRequireRuntime0(path)
{
switch (path) {
xxxx

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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