npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

webpack-vite-serve

v0.1.2

Published

为webpack项目提供一键接入Vite的能力

Readme

webpack-vite-serve

为webpack项目提供一键接入Vite的能力

相关文章:webpack项目接入Vite的通用方案介绍

包管理工具推荐使用pnpm

Usage

Installed

npm install webpack-vite-serve -D
# or
yarn add webpack-vite-serve -D
# or
pnpm add webpack-vite-serve -D

Command Run

# devServer
wvs start [options]
{
  "scripts": {
    "vite:vue": "wvs start -f vue",
    "vite:react": "wvs start -f react",
    "vite": "wvs start"
  }
}
# build
wvs build [options]
{
  "scripts": {
    "build:vite": "wvs build",
  }
}

Options

  • [x] -f,--framework <type>:指定使用的业务框架 (vuereact)
  • [x] -s,--spa:按照单页应用目录结构处理 src/${entryJs}
    • 不指定 -s-m默认按单页应用
  • [x] -m,--mpa:按照多页应用目录结构处理 src/pages/${entryName}/${entryJs}
  • [x] -d,--debug [feat]:打印debug信息
  • [x] -w,--wp2vite:use wp2vite 自动转换webpack文件
  • [ ] -c,--config: 手动指定vite配置路径
  • [ ] -w,--webpack: 手动指定webpack配置路径

其中entryJs匹配命名规则/(index|main)\.[jt]sx?$/

Agreement

工程目录约定

SPA

| Pages Dir | Html Template | Entry Js | | :-------: | :-----------------: | :--------------: | | src | public/index.html | src/${entryJs} |

* public
  * index.html
* src
  * main.ts

MPA

| Pages Dir | Html Template | Entry Js | | :---------: | :--------------------------------------: | :---------------------------------: | | src/pages | src/pages/${pageName}/${pageName}.html | src/pages/${entryName}/${entryJs} | | | src/pages/${pageName}/index.html | - | | | public/index.html | - |

* public
  * index.html
* src
  * pages
    * pageName1
      * main.js
      * pageName.html
    * pageName2
      * index.ts
      * index.html

Supports

  • [x] Vue
  • [x] React
  • [x] SPA - 单页应用
  • [x] MPA - 多页应用
  • [x] build for production - 打包wvs build
  • [x] merge userConfig - 自动合并工程根目录的vite.config.ts文件
  • [x] config transform use wp2vite - webpack配置转换 !!! 存在一些小小问题,准备PR解决
  • [ ] export inline plugin - 对外暴露内置的插件,供单独使用,如处理htmlTemplateentryJs的能力

Demos

  • JS
    • [x] Vue2 SPA
    • [x] React SPA
    • [x] Vue MPA
    • [x] React MPA
  • TS
    • [x] Vue3 SPA
    • [x] React SPA
    • [x] Vue MPA
    • [ ] React MPA

Run Demos

# 1
cd demos

# 2
cd js

# 3
cd demoProject

# 4 推荐pnpm
yarn install
  # or
npm install
  # or 
pnpm install

# 5
# run webpack devServer
npm run dev
# run vite devServer
npm run dev:vite

Local

Dev

使用pnpm

npm i -g pnpm

安装依赖

pnpm install

编译

pnpm dev

激活指令(全局)

npm link

测试指令

wvs hello

Build

使用pnpm

npm i -g pnpm

安装依赖

pnpm install

构建

pnpm build
# or
pnpm dev