Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: to dynamically import file content to support code splitting #6612

Closed
4 tasks done
LiuJiangshan opened this issue Jan 24, 2022 · 1 comment
Closed
4 tasks done
Labels
enhancement New feature or request

Comments

@LiuJiangshan
Copy link

LiuJiangshan commented Jan 24, 2022

Clear and concise description of the problem

After version 2.8 of #5545, the content of the file can be dynamically imported, but the matched files are all packaged into one file, resulting in a large single file.
@ygj6

Suggested solution

await import.meta.glob(`/example/**/*.md`, {assert: {type: 'raw'}})

Add parameter configuration to the method import.meta.glob or return directly:

{
  path1: ()=>import(path1)
}

replace

{
  path: fileContent
}

Alternative

No response

Additional context

No response

Validations

@LiuJiangshan LiuJiangshan changed the title 动态导入文件内容支持代码拆分 feature request: to dynamically import file content to support code splitting Jan 25, 2022
@sapphi-red sapphi-red added enhancement New feature or request and removed enhancement: pending triage labels Jun 5, 2022
@sapphi-red
Copy link
Member

Closing as I confirmed #7537 implemented this.

// input
const mds = import.meta.glob('./mds/*.md', { as: 'raw' });
console.log(mds);
// 2.9.14
const l={"./mds/bar.md":`# bar\r
\r
bar\r
`,"./mds/foo.md":`# foo\r
\r
foo\r
`};console.log(l);
// 3.0.5
const h=Object.assign({"./mds/bar.md":()=>u(()=>import("./bar.978ec4f1.js"),[]).then(r=>r.default),"./mds/foo.md":()=>u(()=>import("./foo.411606e5.js"),[]).then(r=>r.default)});console.log(h);

@github-actions github-actions bot locked and limited conversation to collaborators Aug 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants