Skip to content

Path error #4

Closed
Closed
@liu-lihao

Description

@liu-lihao
import { createApp } from 'vue'
import Index from '/src/options/index.vue'

const app = createApp(Index)
app.mount('#root')
 // The same is true for other onloads
 build.onLoad({filter: /\.vue$/, namespace: "vue"}, async (args) => {
     // args.path === '/src/options/index.vue'
    //  The original code will report an error
    //  no such file or directory, open '/src/options/index.vue'
    const content = await fs.promises.readFile(args.path, "utf8");
    // temporary solution
    const content = await fs.promises.readFile(path.join(process.cwd(), args.path), "utf8");
    // In fact, we should consider relative path, absolute path and alias,
    // but we can't get other information through args

    // ...
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions