mirror of
https://github.com/misitebao/wails-template-vue
synced 2025-05-11 09:38:01 +08:00
Merge pull request #7 from misitebao/feature-refactor-with-vite
refactor: refactor with vite
This commit is contained in:
commit
2be5ce76ce
@ -1,3 +0,0 @@
|
|||||||
> 1%
|
|
||||||
last 2 versions
|
|
||||||
not dead
|
|
26
frontend/.gitignore
vendored
26
frontend/.gitignore
vendored
@ -1,23 +1,5 @@
|
|||||||
.DS_Store
|
|
||||||
node_modules
|
node_modules
|
||||||
# /dist
|
.DS_Store
|
||||||
|
# dist
|
||||||
|
dist-ssr
|
||||||
# local env files
|
*.local
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
|
|
||||||
# Log files
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
|
|
||||||
# Editor directories and files
|
|
||||||
.idea
|
|
||||||
.vscode
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
3
frontend/.vscode/extensions.json
vendored
Normal file
3
frontend/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"recommendations": ["johnsoncodehk.volar"]
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
# wails-template-vue
|
|
||||||
|
|
||||||
## Project setup
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### Compiles and hot-reloads for development
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
### Compiles and minifies for production
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Open the web server to preview the packaged resources
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run serve
|
|
||||||
```
|
|
13
frontend/index.html
Normal file
13
frontend/index.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Vite App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "{{.ProjectName}}",
|
"name": "{{.ProjectName}}",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vite",
|
||||||
"build": "vue-cli-service build",
|
"build": "vite build",
|
||||||
"serve": "serve dist"
|
"serve": "vite preview"
|
||||||
},
|
},
|
||||||
"author": "{{.AuthorName}}",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.0.0",
|
"vue": "^3.2.16",
|
||||||
"vue-i18n": "^9.1.7",
|
"vue-i18n": "^9.1.9",
|
||||||
"vue-router": "^4.0.0-0"
|
"vue-router": "^4.0.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-router": "~4.5.0",
|
"@vitejs/plugin-vue": "^1.9.3",
|
||||||
"@vue/cli-service": "~4.5.0",
|
"sass": "^1.43.4",
|
||||||
"@vue/compiler-sfc": "^3.0.0",
|
"vite": "^2.6.4"
|
||||||
"sass": "^1.26.5",
|
},
|
||||||
"sass-loader": "^8.0.2",
|
"author": "{{.AuthorName}}"
|
||||||
"serve": "^12.0.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 4.2 KiB |
@ -1,19 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>
|
|
||||||
<%= htmlWebpackPlugin.options.title %>
|
|
||||||
</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<noscript>
|
|
||||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
|
||||||
Please enable it to continue.</strong>
|
|
||||||
</noscript>
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
@ -1,12 +1,16 @@
|
|||||||
import { createI18n } from 'vue-i18n'
|
import { createI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
import zhHans from './messages/zh-Hans.json'
|
||||||
|
import en from './messages/en.json'
|
||||||
|
import fr from './messages/fr.json'
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
locale: "en",
|
locale: "en",
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
messages: {
|
messages: {
|
||||||
"zh-Hans": require('./messages/zh-Hans.json'),
|
"zh-Hans": zhHans,
|
||||||
"en": require('./messages/en.json'),
|
"en": en,
|
||||||
"fr": require('./messages/fr.json')
|
"fr": fr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from '@/router'
|
||||||
import i18n from './i18n'
|
import i18n from '@/i18n'
|
||||||
|
|
||||||
// Register global common components
|
// Register global common components
|
||||||
// 注册全局通用组件
|
// 注册全局通用组件
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||||
import Home from '../views/Home.vue'
|
import Home from '@/views/Home.vue'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
|
22
frontend/vite.config.js
Normal file
22
frontend/vite.config.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [vue()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.resolve(__dirname, 'src')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
entryFileNames: `assets/[name].js`,
|
||||||
|
chunkFileNames: `assets/[name].js`,
|
||||||
|
assetFileNames: `assets/[name].[ext]`,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
@ -1,10 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
// The build file does not use the hash file name
|
|
||||||
// 构建文件不使用hash文件名
|
|
||||||
filenameHashing: false,
|
|
||||||
// Package the css into a separate file
|
|
||||||
// 将css打包到单独的文件
|
|
||||||
css: {
|
|
||||||
extract: "true"
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,6 @@
|
|||||||
"outputfilename": "{{.BinaryName}}",
|
"outputfilename": "{{.BinaryName}}",
|
||||||
"assetdir": "frontend/dist",
|
"assetdir": "frontend/dist",
|
||||||
"frontend:install": "npm install",
|
"frontend:install": "npm install",
|
||||||
"frontend:dev":"",
|
|
||||||
"frontend:build": "npm run build",
|
"frontend:build": "npm run build",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "{{.AuthorName}}",
|
"name": "{{.AuthorName}}",
|
||||||
|
Loading…
Reference in New Issue
Block a user