diff --git a/package.json b/package.json index 7d8bee23d..be6d5dccb 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "less": "^4.0.0", "less-loader": "^8.0.0", "lint-staged": "^13.2.1", - "loader-utils": "^2.0.3", "lodash": "^4.17.19", "lodash-es": "^4.17.15", "memfs": "^3.5.0", diff --git a/test/cases/loaders/issue-10725/loader.js b/test/cases/loaders/issue-10725/loader.js index af9af2d24..ff2b34722 100644 --- a/test/cases/loaders/issue-10725/loader.js +++ b/test/cases/loaders/issue-10725/loader.js @@ -1,5 +1,3 @@ -const { getRemainingRequest, stringifyRequest } = require("loader-utils"); - const loaderPath = require.resolve("./loader"); /** @type {import("../../../../").LoaderDefinition} */ @@ -12,12 +10,10 @@ export default answer; `; } - const matchResource = `${this.resourcePath}.js`; - const loader = `${loaderPath}?load`; - const remaining = getRemainingRequest(this); - const request = JSON.parse( - stringifyRequest(this, `${matchResource}!=!${loader}!${remaining}`) - ); + const matchResource = `${this.utils.contextify(this.context, this.resourcePath)}.js`; + const loader = `${this.utils.contextify(this.context, loaderPath)}?load`; + const remaining = this.utils.contextify(this.context, this.remainingRequest); + const request = `${matchResource}!=!${loader}!${remaining}`; this.async(); this.loadModule(request, (err, source) => { diff --git a/test/cases/wasm/two-files-loader/wrapper-loader.js b/test/cases/wasm/two-files-loader/wrapper-loader.js index 827857a6b..6ffbf5029 100644 --- a/test/cases/wasm/two-files-loader/wrapper-loader.js +++ b/test/cases/wasm/two-files-loader/wrapper-loader.js @@ -1,12 +1,9 @@ -const stringifyRequest = require("loader-utils").stringifyRequest; - /** @type {import("../../../../").PitchLoaderDefinitionFunction} */ module.exports.pitch = function (remainingRequest) { return ` - import { getString as _getString, memory } from ${stringifyRequest( - this, - `${this.resourcePath}.wat!=!${remainingRequest}` - )}; + import { getString as _getString, memory } from ${ + JSON.stringify(`${this.utils.contextify(this.context, this.resourcePath)}.wat!=!${this.utils.contextify(this.context, remainingRequest)}`) + }; export function getString() { const strBuf = new Uint8Array(memory.buffer, _getString()); diff --git a/test/cases/wasm/two-files-loader/wrapper-loader2.js b/test/cases/wasm/two-files-loader/wrapper-loader2.js index dde8826aa..6ffbf5029 100644 --- a/test/cases/wasm/two-files-loader/wrapper-loader2.js +++ b/test/cases/wasm/two-files-loader/wrapper-loader2.js @@ -1,12 +1,9 @@ -const stringifyRequest = require("loader-utils").stringifyRequest; - /** @type {import("../../../../").PitchLoaderDefinitionFunction} */ module.exports.pitch = function (remainingRequest) { return ` - import { getString as _getString, memory } from ${stringifyRequest( - this, - `${this.resourcePath}.wasm!=!wast-loader!${remainingRequest}` - )}; + import { getString as _getString, memory } from ${ + JSON.stringify(`${this.utils.contextify(this.context, this.resourcePath)}.wat!=!${this.utils.contextify(this.context, remainingRequest)}`) + }; export function getString() { const strBuf = new Uint8Array(memory.buffer, _getString()); diff --git a/yarn.lock b/yarn.lock index ddfd9611b..1ea0c1cf9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4331,7 +4331,7 @@ loader-utils@^1.1.0: emojis-list "^3.0.0" json5 "^1.0.1" -loader-utils@^2.0.0, loader-utils@^2.0.3: +loader-utils@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c" integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==