Skip to content

import.meta.globEager('../assets/svgIcon/*.svg?raw') #5304

@lihanspace

Description

@lihanspace

Clear and concise description of the problem

将资源批量引入为其他格式。
Batch import resources into other formats.

Suggested solution

import svg from '../assets/svgIcon/github.svg?raw'
console.log(svg)
// Now results 现在的结果
// <svg t="1634195145119" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"...

const files = mport.meta.globEager('../assets/svgIcon/*.svg?raw')
console.log(files)
// Now results 现在的结果
// {}

// Expected results 期望的结果
/*
{
  '../assets/svgIcon/github.svg': {
    raw: '<svg t="1634195145119" class="icon" viewBox="0 0 1024 1024" version="1.1" ...',
    ...
  },
  '../assets/svgIcon/logo.svg': {
    raw: '<svg t="1634195051463" class="icon" viewBox="0 0 1024 1024" version="1.1" ...',
    ...
  }
}
*/

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestp2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions