vite
vite copied to clipboard
warning: Top-level "this" will be replaced with undefined since this file is an ECMAScript module
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
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
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.
@bluwy Added reproduction
Closing as this was fixed by esbuild 0.15.8.