Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/rspack/loaders/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ export default async function load(this: LoaderContext, source: string, map: any
id = decodeVirtualModuleId(id, plugin)

const context = createContext(this)

id = normalizeAbsolutePath(id)
if (id.startsWith('\\'))
id = id.replace(/\\/g, '/')

const res = await plugin.load.call(
Object.assign(
{},
this._compilation && createBuildContext(this._compiler, this._compilation, this),
context,
),
normalizeAbsolutePath(id),
id,
)

if (res == null)
Expand Down
7 changes: 6 additions & 1 deletion src/webpack/loaders/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export default async function load(this: LoaderContext<{ unpluginName: string }>
id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length))

const context = createContext(this)

id = normalizeAbsolutePath(id)
if (id.startsWith('\\'))
id = id.replace(/\\/g, '/')

const res = await plugin.load.call(
Object.assign({}, createBuildContext({
addWatchFile: (file) => {
Expand All @@ -25,7 +30,7 @@ export default async function load(this: LoaderContext<{ unpluginName: string }>
return this.getDependencies()
},
}, this._compiler!, this._compilation, this), context),
normalizeAbsolutePath(id),
id,
)

if (res == null)
Expand Down