Skip to content

Bug: Breaking changes between 0.26.0 and 0.27.0 #159

@cgatian

Description

@cgatian

Summary

There was a change in behavior between 0.26.0 and 0.27.0 (#152) where process became polyfilled. Even though it already existed.

Existing config:

    nodePolyfills({
      include: ['buffer', 'util'],
    }),

In 0.26.0, process would only be overriden if it didnt exist. Now it's always overwritten. This can be seen from the test changes in the PR, globalThis.Buffer = globalThis.Buffer || __buffer_polyfill The polyfill would only apply when it didn't exist.

expect(result?.code).toEqual(formatWhitespace(`
        import __buffer_polyfill from "/shims/buffer/dist/index.js"
        globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
        import __global_polyfill from "/shims/global/dist/index.js"
        globalThis.global = globalThis.global || __global_polyfill
        import __process_polyfill from "/shims/process/dist/index.js"
        globalThis.process = globalThis.process || __process_polyfill

        Buffer.from("test");
      `))

I can workaround this by setting:

    nodePolyfills({
      include: ['buffer', 'util'],
      globals: { process: false, global: true, Buffer: true },
    }),

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