Skip to content

Webpack/rspack call load and transform with escaped paths #591

@edemaine

Description

@edemaine

Environment

unplugin 3.1.0

Reproduction

See PR #592. Without the changes to src, added test fails with message:

Error: load received escaped id: "C:\\Users\\edemaine\\Projects\\unplugin\\test\\fixtures\\hash-path\\src\\msg\u0000#hash.js"
    at assertUnescapedId (C:\Users\edemaine\Projects\unplugin\test\fixtures\hash-path\unplugin.js:11:11)
    at Object.load (C:\Users\edemaine\Projects\unplugin\test\fixtures\hash-path\unplugin.js:33:7)
    at Object.load (file:///C:/Users/edemaine/Projects/unplugin/dist/webpack/loaders/load.mjs:14:28)
    at LOADER_EXECUTION (C:\Users\edemaine\Projects\unplugin\node_modules\.pnpm\loader-runner@4.3.1\node_modules\loader-runner\lib\LoaderRunner.js:195:14)
    at runSyncOrAsync (C:\Users\edemaine\Projects\unplugin\node_modules\.pnpm\loader-runner@4.3.1\node_modules\loader-runner\lib\LoaderRunner.js:196:5)
    at iterateNormalLoaders (C:\Users\edemaine\Projects\unplugin\node_modules\.pnpm\loader-runner@4.3.1\node_modules\loader-runner\lib\LoaderRunner.js:258:2)
    at processResourceCallback (C:\Users\edemaine\Projects\unplugin\node_modules\.pnpm\loader-runner@4.3.1\node_modules\loader-runner\lib\LoaderRunner.js:282:5)
    at Object.processResource (C:\Users\edemaine\Projects\unplugin\node_modules\.pnpm\webpack@5.104.1_esbuild@0.27.2_webpack-cli@6.0.1\node_modules\webpack\lib\NormalModule.js:1094:14)

Describe the bug

Webpack for example escapes # in paths into \0#. These paths get passed into load and transform helpers, which makes it hard to actually load the file in a cross-platform way.

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions