Giter Site home page Giter Site logo

antfu / vscode-vite Goto Github PK

View Code? Open in Web Editor NEW
435.0 5.0 23.0 393 KB

One step faster for Vite in VS Code ⚡️

Home Page: https://marketplace.visualstudio.com/items?itemName=antfu.vite

JavaScript 0.37% TypeScript 99.63%
vscode vscode-extension vite dev-server dx

vscode-vite's Introduction

VS Code for Vite ⚡️

One step faster for Vite

Visual Studio Marketplace Version

  • ⚡️ Start the dev server immediately when you open the project
  • 🚀 Preview / debug your app without leaving your editor
  • ⬢ Prompt for quick node module installs (npm i yarn pnpm i) when opening a fresh project
  • 📦 One-click build and serve
  • 🔄 Restart the server with one-click
  • 📚 Support for VitePress
  • 🔋 Powered by Browse Lite

Demo Preview 1 Preview 2 Preview 3

Sponsors

This project is part of my Sponsor Program.

License

MIT

vscode-vite's People

Contributors

antfu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vscode-vite's Issues

How can i make it start with a project?

Hi.

I have the extension and it opens a browser on my vitesse fork perfectly but im kind of stumped as to how i can make it open automatically in another project.
Anyone?

sorry if this is kind of a dumb question...

Issue with configuration: server starts in wrong location

My repository root is at location /work

The app using Vite is at /work/app

I tried setting the base path for opening the app (Base path for open the app) to /work/app but that didn't work as it still thinks that it should start in /work instead of /work/app

I tried changing the setting "Vite: Dev Command" to cd /work/app && npm run dev. It now does something but now it shows the following error:

[vite] Internal server error: Failed to resolve entry for package "/work/app". The package may have incorrect main/module/exports specified in its package.json.

However, running npm run dev in directory /work/app works just fine.

Note that the VS Code workspace is the root of the local clone. That directory is /work.

I've run out of ideas what else to try. Any and all suggestions would be very much appreciated!

Please create a changelog file

As per https://code.visualstudio.com/api/working-with-extensions/publishing-extension#marketplace-integration a CHANGELOG.md file would be automatically used as the changelog on the extensions page.

It's very useful - I never update an extension until I know what is being changed, and with your extensions I alway shave to manually go to github and read the commits. It would be much easier with a changelog file.

An option would be to use https://github.com/lob/generate-changelog (or something like it) to make it easier?

Vite stops

After start vite from VSCode it stops after 3 or 5 seconds (without any key pressed)

AddOn version : Vite v0.2.5

CleanShot 2022-10-27 at 08 51 29@2x

If I start from terminal, inside or outside VSCode (npx vite --port=8080) it works just fine, just fail if I start from addon

Any ideia ???

Support for `it.each` and `test.each`

Clear and concise description of the problem

Currently this extension doesn't seem to recognize individual test.each test cases. For example:

describe("something", () => {
  test.each([
    { text: "bar", expected: "zoo" },
    { text: "moo", expected: "arf" },
  ])(
    "should properly parse '$expected' from '$text'",
    ({ text, expected }) => {
      expect(foo(text)).toEqual(expected)
    }
  );
});

For this test you will get an option to run/debug the describe block (works) and also the overall test function. If you click run/debug on the overall test function all the individual test cases are skipped. I think this is because the test runner is filtering on the template string: `-t some.module.spec should properly parse '$expected' from '$text'``

Sometimes the test statuses in the sidebar also hang, I believe when they contain a test.each or it.each.

Suggested solution

Add support for test.each / it.each, bot in the sidebar and in the run/debug breadcrumbs.

Alternative

No response

Additional context

No response

Validations

Adding to Open VSX Registry

Any plans to publish your great addons to the the Open VSX Registery?

Why:
Microsoft don't allow other editors to use the Visual Studio Marketplace and its addons therefore forks like VSCodium, code-server, and even the default VS Code version provided by major distributions package managers is actually a fork of VS Code, since the binary releases of it aren't released under a free license.

Open-VSX was born to host plugins written in the VSX format that can be used by any IDE that uses that format, notably Theia IDE which powers GitPod and possibly others, plus the ones I mentioned above.

This means more people will be able to use your plugins on different platforms. ^^

Edit: yes we can download the VSX but it can get tiresome since there would be too many plugins to update and have to check for updates by visiting each plugin's page regularly

Startup fails.

Describe the bug

image

When you open a project using vitepress, it starts automatically, but it starts at some point and then stops.
I didn't give a stop command such as Ctrl+C, but it doesn't progress while asking if I want to stop the command.

But using npm run dev in terminal is not a problem.

Reproduction

It just happens at startup, and even if you start by clicking the bite press icon at the bottom, the same happens after about 10 seconds.

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 20.43 GB / 31.73 GB
  Binaries:
    Node: 16.19.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1413.0), Chromium (111.0.1661.44)
    Internet Explorer: 11.0.22621.1

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Add an option for Package Manager

Clear and concise description of the problem

Currently, we have these two options

  • Vite: Build command - npm build
  • Vite: Dev command - npm dev

The default package manager is NPM and to change it PNPM I have to change both these options.

Suggested solution

It would be great if the package manager can be selected based on the .lock file. But if that is too complex just add another option to change the package manager

  • Vite: Package Manager - [npm/yarn/pnpm]

Alternative

It would be great if the package manager can be selected based on the .lock file

Additional context

No response

Validations

Usage in MonoRepo - Setting "project root"

Coming from Vetur + Quasar to Volar + Vite VSCode plugin + Vitesse and I absolutely love how much more stable (and less fussy) this setup is.

With Vetur, we were able to configure settings for where certain config files and directories were (relative to the project), specifically for monorepos.

I'm currently using a pretty standard monorepo + "workspace" setup --> so the Vite plugin in VSCode cannot correctly find my vite.config.ts file or correctly "read" that this is a Vite project (to get the benefit of automatically starting the server, using the embedded browser view, and debug tools...etc).

I've not been able to find source code or documentation for configuring this plugin to work if I have the following monorepo setup.

├── README.md
├── TODO.md
├── amplify
│   ├── #current-cloud-backend
│   │   ├── amplify-meta.json
│   │   ├── auth
│   │   ├── backend-config.json
│   │   └── tags.json
│   ├── backend
│   │   ├── amplify-meta.json
│   │   ├── auth
│   │   ├── backend-config.json
│   │   └── tags.json
│   ├── cli.json
│   └── team-provider-info.json
├── amplify.yml
├── cz.yaml
├── node_modules
├── package.json
├── packages
│   └── client
│       ├── LICENSE
│       ├── README.md
│       ├── android
│       ├── capacitor.config.json
│       ├── components.d.ts
│       ├── dist
│       ├── generateCapacitorConfig.js
│       ├── index.html
│       ├── ios
│       ├── locales
│       ├── node_modules
│       ├── package.json
│       ├── pnpm-lock.yaml
│       ├── public
│       ├── src
│       ├── tsconfig.json
│       ├── vite.config.ts
│       └── windi.config.ts
└── pnpm-workspace.yaml

Use tasks instead of terminals for the vite process

Is there a specific reason for vscode-vite to use a terminal instead of a task? It seems more reasonable to me to use a task, pretty much like other extensions do (ie, prettier, docker, windicss intellisense, etc).

It's a bit confusing to me to see a new terminal process invoked by the extension, specially if I'm able to manually control it.

I could help with a MR if you were willing to change it.

Thanks!

vscode-site 0.2.5 doesn't work with Vite 5.0

Describe the bug

When use Vite 5.0 vue-ts template and vscode-site 0.2.5, it will try to close(Ctrl+C) after a while.

image

Reproduction

https://stackblitz.com/edit/vitejs-vite-stmbrn?file=index.html&terminal=dev

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz
    Memory: 5.34 GB / 15.75 GB
  Binaries:
    Node: 18.4.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (119.0.2151.72)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

vite icon disaapered!!

Describe the bug

vite 图标消失,记得以前在runner旁就有个绿了吧唧得按钮,最近安装vite使用居然没有了,重新安装vscode和插件都没有,状态栏也没有。

但vite是可以用的,需要快捷键,很不方便。

如果能够解决十分感谢!!

google translate above.

屏幕截图 2023-08-28 101623
屏幕截图 2023-08-28 101721
屏幕截图 2023-08-28 101605

Reproduction

12312

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (4) x64 Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
    Memory: 1.60 GB / 7.88 GB
  Binaries:
    Node: 18.17.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.12 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Spartan (44.22621.2134.0), Chromium (116.0.1938.62)
    Internet Explorer: 11.0.22621.1

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Enabling this extension results in Go linting errors in Typescript

Describe the bug

I toggled each of my 88 extensions to identify this one as the culprit for the strange issue of Go linting errors showing up in my typescript code:

exported identifier <T> should have comment or be unexported

For example:

CleanShot 2022-12-24 at 14 56 35@2x

Reproduction

Install extension. Write typescript where you export an uncomment const function

System Info

Node: 18.12.1 - /usr/local/bin/node

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Failed to start the server (notification), but the server was started

Describe the bug

When I opened my project, the extension auto-start the website, but I've got the Failed to start the server error BUT but my website opened and executed well.

Reproduction

https://github.com/thomasbnt/vuejs3-sass-lucide-starter-kit

System Info

System:
    OS: Linux 5.10 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 22.72 GB / 25.02 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.1/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

[Linux] No Chrome installation found, or no Chrome executable set in the settings.

Describe the bug

The extension cant find the installation chrome. On windows never had the same problem.

Reproduction

1.Start Vite 2.Open in embedded window

System Info

System:
    OS: Linux 5.19 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.14.1 - ~/.nvm/versions/node/v18.14.1/bin/node
    Yarn: 3.3.1 - ~/.nvm/versions/node/v18.14.1/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v18.14.1/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
    Firefox: 111.0

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Feature request: Option to ignore HTTPS errors

Currently if there are HTTPS errors the extension fails to detect that the server has started. If would be useful to have a setting equivalent to that in Browse-lite which would ignore HTTPS errors when pinging the server

Disable embedded browser.

Describe the bug
When I open Vite project in VS code it opens an embedded browser. That browser doesn't work well for me. I'd like to disable that, but the documented options don't seem to work.

My first attempt was based on the instructions found at https://vitejs.dev/config/#server-https . It says that I can specify a boolean for server.open in the config file. I set that value to false in my vite.config.ts. VS Code validated that I had the right syntax. You can see the entire config file in the Reproduction section, below.

Further googling brought me to this page. vitejs/vite#2552. That suggests that there might be a workaround using command line arguments. I'm willing to try, but I don't know where the command line is! I have installed the Vite plugin for VS code and I have created a config file. That combination is all it takes to bring up that embedded browser each time I restart VS code or reopen this project.

I appreciate any help you can offer.

Reproduction
https://github.com/TradeIdeasPhilip/bounce-3d/blob/master/vite.config.ts

System Info
npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers

System:
OS: macOS 12.3.1
CPU: (8) arm64 Apple M1
Memory: 239.16 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.0.0 - ~/.nvm/versions/node/v18.0.0/bin/node
npm: 8.6.0 - ~/.nvm/versions/node/v18.0.0/bin/npm
Browsers:
Chrome: 101.0.4951.64
Safari: 15.4
npmPackages:
vite: ^2.9.9 => 2.9.9

Originally reported here vitejs/vite#8332 but they sent me to you,

Can’t use this plugin, show spawn UNKNOWN error

I tried many ways but failed to fix it

ENV info:
Version: 1.64.0-insider (user setup)
Commit: 886fd126446cd4b8b03f2b32f09c173dec541e6d
Date: 2021-12-14T16:25:19.507Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

image

Can't figure out how to create project

How do you create a project (folder) with this plugin and use the run button to launch the webserver (like in the gif on the main readme.md)? I have searched for quite a long time now and have not found a quickstart for this VScode plugin.
Thank you

Embedded browser doesn't open

After clicking the vite button at bottom status bar, I clicked on open with embedded browser and it showed error as shown in image below:

4K display blurry

OS: Windows 11 Pro build 22621.105

  • 2160P 200% scaling
    image
  • 1080P 100% scaling
    image

Allow for custom flag settings

Clear and concise description of the problem

I have customized my dev command to be vercel dev to ensure my Serverless Functions for Vercel are usable within this extension. When the command runs, you can see this error:

130 % vercel dev --port=4000
Vercel CLI 30.0.0
WARN! `--port` is deprecated, please use `--listen` instead
> Running Dev Command “vite --port $PORT”

  VITE v4.3.9  ready in 145 ms

  ➜  Local:   http://localhost:4000/
  ➜  Network: use --host to expose
  ➜  press h to show help
> Ready! Available at http://localhost:4000
WARN! `--port` is deprecated, please use `--listen` instead

Suggested solution

Allow users to specify custom flag names or a flag override field would be the ideal solution.

Alternative

Have a field that allows users to input their own flags and ignore the default port field? Not sure.

Additional context

It looks like --port is hardcoded at the moment:

command += ` --port=${ctx.port}`

Validations

DevTools error: "WebSocket Disconnected"

Describe the bug

The preview works perfectly, but when I open DevTools I get the error Debugging connection was closed. Reason: WebSocket Disconnected. Reconnect when ready by reopening DevTools. As far as I've seen the other features work fine, and there don't seem to be any relevant console errors.

Reproduction

N/A

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
    Memory: 9.41 GB / 15.90 GB
  Binaries:
    Node: 20.2.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.6.6 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1702.0)
    Internet Explorer: 11.0.22621.1

VSCode Details:
Version: 1.79.0 (user setup)
Commit: b380da4ef1ee00e224a15c1d4d9793e27c2b6302
Date: 2023-06-07T14:26:35.552Z
Electron: 22.5.5
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22621

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Switch to built-in "Simple browser"

Clear and concise description of the problem

Currently there is a plethora of bugs with the embedded browser. It...

Suggested solution

VSCode has a built-in "Simple browser" extension since a while ago: microsoft/vscode#109276

As it is a proper built-in extension and uses the rendering engine already embedded inside electron it does not suffer from the problems of the current screensharing architecture. This will likely resolve every issue listed above!

Alternative

Fix vscode-browse-lite, though I do not consider this worth the effort given the limitations of it architecture.

Additional context

The only drawback will be that devtools will be a bit less nice. One has to use the electron devtools (Help > Toggle Developer Tools) which are not in a nice tab like the current ones. However, I definitely consider this drawback justified given the amount of advantages this switch would bring.
Furthermore, one can still open it in an external browser if some parts of the devtools are limiting inside VSCode.

Validations

[FR] Open embedded browser in separate vscode window

As I work across multiple screens I would love the ability to move the embedded browser to a separate vscode window. Unless I'm missing something there doesn't appear to be a way to do that at present.

Big thank you for your work on this extension, together with Vite this greatly eases our workflow 👍

Embedded browser <select> doesn't dropdown

Describe the bug

In the embedded browser, select elements don't display the options dropdown when clicked, also the element auto selects the first option as default.

Reproduction

bind any select element to a group of options and open in embedded browser.

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (8) x64 AMD Ryzen 7 4700U with Radeon Graphics
    Memory: 3.42 GB / 15.23 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 104.0.5112.102
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.70)

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Settings can't be configured at folder level

Describe the bug

We need to customize this plugin for all users of our repo so I was trying to configure settings in the "folder" tab - aka writing to vscode/settings.json. But this plugin doesn't show up in that tab, I can only configure it for workspace or user.

Reproduction

N/A

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 14.71 GB / 31.73 GB
  Binaries:
    Node: 18.9.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.4.1 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.19.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (114.0.1823.58)
    Internet Explorer: 11.0.22000.120

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.