Skip to content

process is not defined when used in Vanilla JS (without Node.js) #6078

Open

Description

@DeathKing

TanStack Table version

v8.21.3

Framework/Library version

vanilla (through Rails importmap)

Describe the bug and the steps to reproduce it

I'm using @tan-stack/table-core in vanilla JS without any bundler or Node.js runtime. It seems that createTable() function checks runtime environment for debugging, which throw an exception for my setup.

const M = [t, c, s, a, n, l, p, m, F, r, f, C, h, S, g];
function createTable(e) {
    var t, n;
    process.env.NODE_ENV !== "production" && (e.debugAll || e.debugTable) && console.info("Creating Table Instance...");

I temporarily use a mock process object to workaround. Would it be nicer to check process at first?

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

(no need)

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Yes, I think I know how to fix it and will discuss it in the comments of this issue

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Activity

  1. BranLiang commented on Nov 12, 2025

    @BranLiang

    Got the same error, here is the solution I made to bypass that.

    1. Pin the umd build package, instead of the default one from the command bin/importmap pin @tanstack/table-core
    pin "@tanstack/table-core", to: "https://unpkg.com/@tanstack/table-core@8.21.3/build/umd/index.development.js" # @8.21.3
    
    1. In the stimulus controller, import tanstack-core, and use the global variable TableCore.
    import "@tanstack/table-core";
    
    ...
    
    const columnHelper = TableCore.createColumnHelper();
    
    ...
    

    In the umd build, there is no process env check.

  2. added a commit that references this issue on Mar 4, 2026
    58c1584
  3. isaackaara commented on Mar 4, 2026

    @isaackaara

    Opened #6185 with a fix for this. The issue is that the ESM build output preserves raw process.env.NODE_ENV references, which throw in environments without Node.js globals. The fix introduces a safe isDev() utility that checks for the existence of process before accessing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions