0.1.0 โ€ข Published 4 months ago

@unicommerce/vite-config v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@unicommerce/vite-config

๐ŸŽ‰ Introduce

vite้…็ฝฎ้กน

๐Ÿ“š Documentation

๐Ÿ“ฆ Install

$ npm install --save-dev @unicommerce/vite-config
# or
$ yarn add --save-dev @unicommerce/vite-config
# or
$ pnpm add --save-dev @unicommerce/vite-config

๐Ÿ”จ Usage

// vite.config.ts

import { baseConfig } from '@unicommerce/vite-config'
import path from 'node:path'
import type { ConfigEnv } from 'vite'
import { defineConfig } from 'vite'

import pkg from './package.json'

const viteConfig: any = ({ mode }: ConfigEnv) => {
  const defaultConfig: any = baseConfig({
    mode,
    pkg,
    https: true,
    entry: '/bootstrap/main.tsx',
    outDir: 'build',
    cdnOptions: {
      enableInDevMode: true,
      modules: ['react', 'react-dom']
    }
  })

  return defineConfig({
    ...defaultConfig,
    resolve: {
      alias: {
        '@': path.resolve(__dirname, './'),
        '~': path.resolve(__dirname, './')
      }
    },
    server: {
      host: '127.0.0.1',
      port: 3000
    }
  })
}

export default viteConfig