Skip to content

sourceURL contains null-character at the beginning #145

@derolf

Description

@derolf

I am having a very weird. Some of the sourceURL references in my nolluped files contain a null-character at the beginning. Example:

//# sourceURL=<null-character-here>commonjsHelpers.js');

I was tracing the problem at least up to this position in PluginLifecycle.js:

        async resolveId (context, id, parentFilePath) {
            let hr = await callAsyncFirstHook(context, 'resolveId', [id, parentFilePath]);

            if (hr === false) {
                return false;
            }


            if (typeof hr === 'string') {
                if (hr[0] === '\000') {
                    throw Error(`"${hr}" contains a null-character at the beginning. encodeURI yields: ${encodeURI(hr)}`);
                }

With this debug code, I get this on the console:

[Nollup] Listening on http://localhost:8081
Error: "commonjsHelpers.js" contains a null-character at the beginning. encodeURI yields: %00commonjsHelpers.js
    at Object.resolveId (/Users/darolf/dev/superapp/node_modules/nollup/lib/impl/PluginLifecycle.js:138:27)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Since I am lost in the details how plugin/hooks get called by nollup, I don't know how to trace this to the source problem.

Any idea how this can happen???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions