使用范围的依赖重定向
【Dependency redirection using scopes】
以下示例将允许访问 ./app/ 中的所有资源的 fs:
【The following example, would allow access to fs for all resources within
./app/:】
{
"resources": {
"./app/checked.js": {
"cascade": true,
"integrity": true
}
},
"scopes": {
"./app/": {
"dependencies": {
"fs": true
}
}
}
} 下面的示例将允许所有 data: 资源访问 fs:
【The following example, would allow access to fs for all data: resources:】
{
"resources": {
"data:text/javascript,import('node:fs');": {
"cascade": true,
"integrity": true
}
},
"scopes": {
"data:": {
"dependencies": {
"fs": true
}
}
}
}