2022-06-22 15:13:36 +08:00
|
|
|
export async function resolve(url, context, next) {
|
2022-12-17 12:23:11 +08:00
|
|
|
// This check is needed to make sure that we don't prevent the
|
|
|
|
// resolution from follow-up loaders. It wouldn't be a problem
|
|
|
|
// in real life because loaders aren't supposed to break the
|
|
|
|
// resolution, but the ones used in our tests do, for convenience.
|
2023-04-13 15:35:17 +08:00
|
|
|
if (url === 'node:fs' || url.includes('loader')) {
|
2022-12-17 12:23:11 +08:00
|
|
|
return next(url);
|
|
|
|
}
|
|
|
|
|
2022-05-04 23:51:12 +08:00
|
|
|
const {
|
|
|
|
format,
|
|
|
|
url: nextUrl,
|
2022-06-22 15:13:36 +08:00
|
|
|
} = await next(url, context);
|
2022-05-04 23:51:12 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
format,
|
|
|
|
url: `${nextUrl}?foo`,
|
|
|
|
};
|
|
|
|
}
|