Lit Uncaught ReferenceError: process is not defined when using mobx

I am building frontend web app using lit framework and mobx, lit-mobx for state management. I am getting ‘Uncaught ReferenceError: process is not defined’ if I try to use observable property from mobx.

index.html

<!doctype html>

<html>
  <head>
    <meta charset="utf-8" />
    <title><Overview</title>
    <script src="./index.js"></script>
    <script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
    <script src="../node_modules/lit/polyfill-support.js"></script>
   
    <script type="module" src="../AppRoot.js"></script>
    <style>
      p {
        border: solid 1px blue;
        padding: 8px;
      }

    </style>
  </head>
  <body style="margin:0;">
    <style>
      html {
        box-sizing: border-box;
      }
      *, *:before, *:after {
        box-sizing: inherit;
      }
    </style>
    <sp-theme scale="large" color="light  ">
      <div>"helloWorld"</div>
      <root-ui></root-ui>
    </sp-theme>
  </body>
</html>

AppRoot.ts

import { RegisterComponents } from './RegisterComponents.js';


export class AppRoot {

    init(){
        new RegisterComponents().init();
        //storeProvider.rootStore = new RootStore();
    }
}

new AppRoot().init();

RootUI.ts

import { rootStore } from "../../../stores/RootStore";

export class RootUI extends LitElement {
    static readonly TAG_NAME = "root-ui";

override render() {
        rootStore.init();
}

declare global {
    interface HTMLElementTagNameMap {
      'root-ui': RootUI;
    }
  }

RootStore.ts

import { observable } from "mobx";

export class RootStore {

   @observable private _initialized = false;

    constructor() {
        console.log("in rootstore");
    }

    init() {
        console.log("in rootstore init", this._initialized);
    }
}

const rootStore = new RootStore();
export { rootStore };

If I remove @observable then everything works fine. I am assuming there is some configuration related issue with mobx, I am not able to figure out. I also tried to set the below config in index.ts but it didn’t wokr.

import { configure } from 'mobx';

configure({
    isolateGlobalState: true,
    // We should only be able to update observable values via actions
    enforceActions: "observed"
});

package.json

{
  "name": "@lit/lit-starter-ts",
  "private": true,
  "version": "2.0.1",
  "description": "A simple web component",
  "main": "Homepage.js",
  "module": "Homepage.js",
  "type": "module",
  "scripts": {
    "build": "tsc",
    "build:watch": "tsc --watch",
    "clean": "rimraf my-element.{d.ts,d.ts.map,js,js.map} test/my-element.{d.ts,d.ts.map,js,js.map} test/my-element_test.{d.ts,d.ts.map,js,js.map}",
    "lint": "npm run lint:lit-analyzer && npm run lint:eslint",
    "lint:eslint": "eslint 'src/**/*.ts'",
    "lint:lit-analyzer": "lit-analyzer",
    "format": "prettier "**/*.{cjs,html,js,json,md,ts}" --ignore-path ./.eslintignore --write",
    "docs": "npm run docs:clean && npm run build && npm run analyze && npm run docs:build && npm run docs:assets && npm run docs:gen",
    "docs:clean": "rimraf docs",
    "docs:gen": "eleventy --config=.eleventy.cjs",
    "docs:gen:watch": "eleventy --config=.eleventy.cjs --watch",
    "docs:build": "rollup -c --file docs/my-element.bundled.js",
    "docs:assets": "cp node_modules/prismjs/themes/prism-okaidia.css docs/",
    "docs:serve": "wds --root-dir=docs --node-resolve --watch",
    "analyze": "cem analyze --litelement --globs "src/**/*.ts"",
    "analyze:watch": "cem analyze --litelement --globs "src/**/*.ts" --watch",
    "serve": "wds --watch",
    "serve:prod": "MODE=prod npm run serve",
    "test": "npm run test:dev && npm run test:prod",
    "test:dev": "wtr",
    "test:watch": "wtr --watch",
    "test:prod": "MODE=prod wtr",
    "test:prod:watch": "MODE=prod wtr --watch",
    "checksize": "rollup -c ; cat my-element.bundled.js | gzip -9 | wc -c ; rm my-element.bundled.js"
  },
  "keywords": [
    "web-components",
    "lit-element",
    "typescript",
    "lit"
  ],
  "author": "Google LLC",
  "license": "BSD-3-Clause",
  "dependencies": {
    "@adobe/lit-mobx": "2.0.0",
    "@spectrum-web-components/button": "^0.42.5",
    "@spectrum-web-components/radio": "^0.42.5",
    "@spectrum-web-components/theme": "^0.42.5",
    "lit": "2.7.4",
    "mobx": "6.1.7"
  },
  "devDependencies": {
    "@11ty/eleventy": "^1.0.1",
    "@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
    "@custom-elements-manifest/analyzer": "^0.6.3",
    "@open-wc/testing": "^3.1.5",
    "@rollup/plugin-node-resolve": "^13.3.0",
    "@rollup/plugin-replace": "^5.0.2",
    "@typescript-eslint/eslint-plugin": "^5.25.0",
    "@typescript-eslint/parser": "^5.25.0",
    "@web/dev-server": "^0.1.31",
    "@web/dev-server-legacy": "^1.0.0",
    "@web/test-runner": "^0.15.0",
    "@web/test-runner-playwright": "^0.9.0",
    "@webcomponents/webcomponentsjs": "^2.8.0",
    "eslint": "^8.15.0",
    "lit-analyzer": "^1.2.1",
    "prettier": "^2.6.2",
    "rimraf": "^3.0.2",
    "rollup": "^2.73.0",
    "rollup-plugin-summary": "^1.4.3",
    "rollup-plugin-terser": "^7.0.2",
    "typescript": "~5.3.3"
  },
  "customElements": "custom-elements.json"
}

Any help will be really appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật