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

fix: context for loader without resource #409

Merged
merged 1 commit into from Nov 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/utils.js
Expand Up @@ -1169,13 +1169,14 @@ export function getImportCode(html, loaderContext, imports, options) {
return "";
}

// TODO simplif in the next major release
// TODO simpify in the next major release
const getURLRuntime = require.resolve("./runtime/getUrl.js");
const context = loaderContext.context || loaderContext.rootContext;
const fileURLToHelper =
typeof loaderContext.utils !== "undefined" &&
typeof loaderContext.utils.contextify === "function"
? loaderContext.utils.contextify(loaderContext.context, getURLRuntime)
: contextify(loaderContext.context, getURLRuntime);
? loaderContext.utils.contextify(context, getURLRuntime)
: contextify(context, getURLRuntime);

let code = options.esModule
? `import ${GET_SOURCE_FROM_IMPORT_NAME} from "${fileURLToHelper}";\n`
Expand Down