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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mxnet/build

v0.6.6

Published

build vue,react app

Downloads

2

Readme

@mxnet/build

description

脚手架的基础建设 与 vite 结合

Usage

import { ViteConfiguration } from "@mxnet/build";
// ViteConfiguration 是一切配置的开始

// 我们应该考虑清楚我们的 project run 在哪个场景? mobile ? pc ?
const config = new ViteConfiguration().setScenes("mobile"); // 设置场景

// 考虑技术选型

// 第一个参数是技术栈名称,第二个参数则会根据场景提示相应的配置,可忽略,忽略则注入 mobile 下 vue 的默认配置 , 可以 default:false 拒绝注入
config.setTechnologyStack("vue", { default: false });

// 导出配置传递给vite
config.getConfig();
// 构建一个 基础的 mobile vue vite config
import { ViteConfiguration } from "@mxnet/build";
const config = new ViteConfiguration()
  .setScenes("mobile")
  .setTechnologyStack<"vue", "mobile">("vue", { default: false })
  .getConfig({} /* vite config */);

全局默认配置

  • 默认路径别名 ~/
import {} from '~/assets/

mobile 下的默认配置

vue and react

  • postcss-px-to-viewport : pxvw postcss 插件 默认开启,可以关闭可配置
// 禁用 postcss-px-to-viewport
const config = new ViteConfiguration()
  .setScenes("mobile")
  .setTechnologyStack<"vue", "mobile">("vue", { postcssPxToViewport: false });
// 配置 postcss-px-to-viewport
const config = new ViteConfiguration()
  .setScenes("mobile")
  .setTechnologyStack<"vue", "mobile">("vue", { postcssPxToViewport: {} });

more

vconsole

  • tips: 默认不开启vconsole, 你也可以通过配置修改。更多配置见
const viteConfig = new ViteConfiguration()
  .setScenes("mobile")
  .setTechnologyStack("vue")
  .addVConsole()
  .getConfig({});
export default ({ command, mode }: ConfigEnv): UserConfigExport => {
    return new ViteConfiguration().setScenes('mobile').setTechnologyStack('vue').addVConsole({
        entry: [path.resolve('src/main.ts')],
        localEnabled: command === 'serve',
        enabled: command !== 'serve' || mode === 'test',
        config: { // vconsole options
          maxLogNumber: 1000,
          theme: 'light'
        }
    }).getConfig({
    })
};

auto import api

  • 选项参考

  • addAutoImport(options?) api 会根据技术栈 setTechnologyStack api 自动生成对应的.d.ts文件

  • 技术栈 vue 会默认生成 vue pinia vue-router .d.ts文件

  • 技术栈 react 会默认生成 react .d.ts文件

const config = new ViteConfiguration()
  .setScenes("mobile")
  .setTechnologyStack("vue")
  .addAutoImport()
  .getConfig() as UserConfig;

addRouteLazyLoading

此选项只对 vue 生效,且在类型上做了限制,在技术栈设置为 react 时候此选项不会被提醒,类型检查期间会报错

/**
 * @desc 定义vue路由分块, useage see link
 * @see https://router.vuejs.org/zh/guide/advanced/lazy-loading.html#%E4%BD%BF%E7%94%A8-vite
 */
new ViteConfiguration().setTechnologyStack("vue").addRouteLazyLoading({});

Plugin