vite icon indicating copy to clipboard operation
vite copied to clipboard

warning: Top-level "this" will be replaced with undefined since this file is an ECMAScript module

Open hornta opened this issue 1 year ago • 2 comments

Describe the bug

I'm receiving this warning whenever I do pnpm run dev. Everything seems to work non the less but I think this shouldn't appear.

Reproduction

https://stackblitz.com/edit/vitejs-vite-jvs1a8?file=src/main.tsx

13:57:37 [vite] warning: Top-level "this" will be replaced with undefined since this file is an ECMAScript module
88 |                to: path,
89 |                key: path,
90 |                __self: this,
   |                        ^
91 |                __source: {
92 |                  fileName: _jsxFileName,

  Plugin: vite:esbuild
  File: C:/Users/hornta/Documents/exopen/admin-portal/src/common/components/layout/BreadcrumbsLayout.tsx

Config

import { defineConfig, defaultExclude } from "vitest/config";
import react from "@vitejs/plugin-react";
import svgr from "vite-plugin-svgr";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), svgr()],
  server: {
    port: 3000,
  },
  build: {
    outDir: "build",
  },
  test: {
    environment: "jsdom",
    setupFiles: "./src/setupTests.ts",
    exclude: [...defaultExclude, "./tests"],
  },
});

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz     
    Memory: 3.09 GB / 15.95 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 105.0.5195.102
    Edge: Spartan (44.19041.1266.0), Chromium (105.0.1343.33)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vitejs/plugin-react: ^2.1.0 => 2.1.0 
    vite: ^3.1.0 => 3.1.0

Used Package Manager

pnpm

Logs

No response

Validations

hornta avatar Sep 13 '22 12:09 hornta

Hello @hornta. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

github-actions[bot] avatar Sep 13 '22 13:09 github-actions[bot]

@bluwy Added reproduction

hornta avatar Sep 13 '22 17:09 hornta

Closing as this was fixed by esbuild 0.15.8.

sapphi-red avatar Sep 19 '22 07:09 sapphi-red