Перевёл сайт с vue-cli на vite #2

This commit is contained in:
Ilia Miheev
2026-07-31 23:59:23 +03:00
parent 74f6416521
commit d8e183a0e3
10 changed files with 1362 additions and 11038 deletions
+16 -6
View File
@@ -1,24 +1,34 @@
# irandom # irandom
## Project setup ## Setup
``` ```
npm install npm install
``` ```
### Compiles and hot-reloads for development ### Dev server
``` ```
npm run serve npm run serve
``` ```
or
```
npm run dev
```
### Compiles and minifies for production ### Production build
``` ```
npm run build npm run build
``` ```
### Lints and fixes files ### Preview production build
```
npm run preview
```
### Lint
``` ```
npm run lint npm run lint
``` ```
### Customize configuration ### Customization
See [Configuration Reference](https://cli.vuejs.org/config/). Copy `.env.example` to `.env` and set branding / theme variables.
`npm run serve` / `npm run build` regenerates `public/config.js` automatically.
-5
View File
@@ -1,5 +0,0 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
+18
View File
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="/logo.png" />
<title>irandom</title>
<script src="/config.js"></script>
</head>
<body>
<noscript>
<strong>Для работы irandom нужен JavaScript.</strong>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
+7 -13
View File
@@ -1,19 +1,13 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "ESNext",
"module": "esnext", "module": "ESNext",
"baseUrl": "./", "baseUrl": "./",
"moduleResolution": "node", "moduleResolution": "bundler",
"paths": { "paths": {
"@/*": [ "@/*": ["src/*"]
"src/*"
]
}, },
"lib": [ "lib": ["ESNext", "DOM", "DOM.Iterable"]
"esnext", },
"dom", "exclude": ["node_modules", "dist"]
"dom.iterable",
"scripthost"
]
}
} }
+1285 -10969
View File
File diff suppressed because it is too large Load Diff
+17 -22
View File
@@ -4,33 +4,33 @@
"private": true, "private": true,
"scripts": { "scripts": {
"generate-config": "node scripts/generate-config.js", "generate-config": "node scripts/generate-config.js",
"predev": "node scripts/generate-config.js",
"dev": "vite",
"preserve": "node scripts/generate-config.js", "preserve": "node scripts/generate-config.js",
"serve": "vite",
"prebuild": "node scripts/generate-config.js", "prebuild": "node scripts/generate-config.js",
"serve": "vue-cli-service serve", "build": "vite build",
"build": "vue-cli-service build", "preview": "vite preview",
"lint": "vue-cli-service lint" "lint": "eslint --ext .js,.vue src"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.2", "@element-plus/icons-vue": "^2.3.2",
"core-js": "^3.8.3",
"element-plus": "^2.14.3", "element-plus": "^2.14.3",
"vue": "^3.2.13", "vue": "^3.5.13",
"vue-router": "^4.6.4" "vue-router": "^4.6.4"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.16", "@vitejs/plugin-vue": "^5.2.1",
"@babel/eslint-parser": "^7.12.16", "eslint": "^8.57.1",
"@vue/cli-plugin-babel": "~5.0.0", "eslint-plugin-vue": "^9.32.0",
"@vue/cli-plugin-eslint": "~5.0.0", "sass": "^1.83.0",
"@vue/cli-service": "~5.0.0", "vite": "^6.0.7"
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"sass": "^1.32.7",
"sass-loader": "^12.0.0"
}, },
"eslintConfig": { "eslintConfig": {
"root": true, "root": true,
"env": { "env": {
"browser": true,
"es2021": true,
"node": true "node": true
}, },
"extends": [ "extends": [
@@ -38,14 +38,9 @@
"eslint:recommended" "eslint:recommended"
], ],
"parserOptions": { "parserOptions": {
"parser": "@babel/eslint-parser" "ecmaVersion": "latest",
"sourceType": "module"
}, },
"rules": {} "rules": {}
}, }
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
} }
-18
View File
@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>logo.png">
<title>irandom</title>
<script src="<%= BASE_URL %>config.js"></script>
</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>
<!-- built files will be auto injected -->
</body>
</html>
+1 -1
View File
@@ -34,7 +34,7 @@ const routes = [
] ]
const router = createRouter({ const router = createRouter({
history: createWebHistory(process.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes routes
}) })
+18
View File
@@ -0,0 +1,18 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
server: {
port: 8080
}
})
-4
View File
@@ -1,4 +0,0 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})