Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
likuner committed Jun 25, 2022
1 parent 5545f3e commit 92b128f
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 73 deletions.
4 changes: 2 additions & 2 deletions src/components/Demo.module.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.container {
width: 50%;
margin: 20px;
width: 50%;
margin: 20px;
}
2 changes: 1 addition & 1 deletion src/components/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from './demo.module.less'

export default defineComponent({
setup() {
const msg = ref('Hello ViewUIPlus!')
const msg = ref('Hello View UI Plus!')

return () => (
<div class={styles.container}>
Expand Down
8 changes: 4 additions & 4 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// <reference types="vite/client" />

declare module '*.vue' {
import type { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
import type { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
10 changes: 5 additions & 5 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createRouter, createWebHistory } from 'vue-router'
import routes from './routes'

export default createRouter({
routes,
history: createWebHistory(),
scrollBehavior() {
return { top: 0 }
}
routes,
history: createWebHistory(),
scrollBehavior() {
return { top: 0 }
}
})
8 changes: 4 additions & 4 deletions src/router/routes.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
{
path: '/',
component: () => import('@/components/Demo')
}
{
path: '/',
component: () => import('@/components/Demo')
}
]

export default routes
114 changes: 57 additions & 57 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,67 @@ const autoprefixer = require('autoprefixer')
const path = require('path')

const config = ({ mode }) => {
const isProd = mode === 'production'
const envPrefix = 'APP_'
const { APP_TITLE = '' } = loadEnv(mode, process.cwd(), envPrefix)
return {
plugins: [
vue(),
vueJsx({
// options are passed on to @vue/babel-plugin-jsx
}),
createHtmlPlugin({
minify: isProd,
inject: {
data: {
title: APP_TITLE,
},
}
})
],
build: {
target: 'es2015',
outDir: path.resolve(__dirname, 'dist'),
assetsDir: 'assets',
assetsInlineLimit: 8192,
sourcemap: !isProd,
emptyOutDir: true,
rollupOptions: {
input: path.resolve(__dirname, 'index.html'),
output: {
chunkFileNames: 'js/[name].[hash].js',
entryFileNames: 'js/[name].[hash].js',
}
}
},
envPrefix,
resolve: {
alias: [
{ find: /^@\//, replacement: path.resolve(__dirname, 'src') + '/' },
{ find: /^~/, replacement: '' }
],
extensions: ['.ts', '.tsx', '.js', '.mjs', '.vue', '.json', '.less', '.css']
},
css: {
postcss: {
const isProd = mode === 'production'
const envPrefix = 'APP_'
const { APP_TITLE = '' } = loadEnv(mode, process.cwd(), envPrefix)
return {
plugins: [
autoprefixer
vue(),
vueJsx({
// options are passed on to @vue/babel-plugin-jsx
}),
createHtmlPlugin({
minify: isProd,
inject: {
data: {
title: APP_TITLE,
},
}
})
],
},
preprocessorOptions: {
less: {
javascriptEnabled: true,
additionalData: `@import "${path.resolve(__dirname, 'src/styles/variable.less')}";`
build: {
target: 'es2015',
outDir: path.resolve(__dirname, 'dist'),
assetsDir: 'assets',
assetsInlineLimit: 8192,
sourcemap: !isProd,
emptyOutDir: true,
rollupOptions: {
input: path.resolve(__dirname, 'index.html'),
output: {
chunkFileNames: 'js/[name].[hash].js',
entryFileNames: 'js/[name].[hash].js',
}
}
},
envPrefix,
resolve: {
alias: [
{ find: /^@\//, replacement: path.resolve(__dirname, 'src') + '/' },
{ find: /^~/, replacement: '' }
],
extensions: ['.ts', '.tsx', '.js', '.mjs', '.vue', '.json', '.less', '.css']
},
css: {
postcss: {
plugins: [
autoprefixer
],
},
preprocessorOptions: {
less: {
javascriptEnabled: true,
additionalData: `@import "${path.resolve(__dirname, 'src/styles/variable.less')}";`
}
}
},
server: {
open: true
},
preview: {
port: 5000
}
}
},
server: {
open: true
},
preview: {
port: 5000
}
}
}

export default defineConfig(config)

0 comments on commit 92b128f

Please sign in to comment.