Skip to content

Commit

Permalink
migration: remove SSR and switch build setup to Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 5, 2021
1 parent 98399b5 commit 565b948
Show file tree
Hide file tree
Showing 19 changed files with 791 additions and 5,570 deletions.
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

85 changes: 0 additions & 85 deletions build/setup-dev-server.js

This file was deleted.

83 changes: 0 additions & 83 deletions build/webpack.base.config.js

This file was deleted.

75 changes: 0 additions & 75 deletions build/webpack.client.config.js

This file was deleted.

33 changes: 0 additions & 33 deletions build/webpack.server.config.js

This file was deleted.

7 changes: 4 additions & 3 deletions src/index.template.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" sizes="120x120" href="/public/logo-120.png">

This comment has been minimized.

Copy link
@yyx990803

yyx990803 May 6, 2021

Author Member

In Vite, files in the public directory are served at server root, so all asset paths that started with /public/ are changed to /. This includes paths in Vue files and manifest.json.

Docs: https://vitejs.dev/guide/assets.html#the-public-directory

This comment has been minimized.

Copy link
@asadbr

asadbr Jul 8, 2021

Good Idea

<link rel="apple-touch-icon" sizes="120x120" href="/logo-120.png">
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
<link rel="shortcut icon" sizes="48x48" href="/public/logo-48.png">
<link rel="shortcut icon" sizes="48x48" href="/logo-48.png">
<meta name="theme-color" content="#f60">
<link rel="manifest" href="/manifest.json">
<style>
Expand All @@ -18,6 +18,7 @@
</head>
<body>
<div id="skip"><a href="#app">skip to content</a></div>
<!--vue-ssr-outlet-->
<div id="app"></div>
<script type="module" src="/src/entry-client.js"></script>

This comment has been minimized.

Copy link
@yyx990803

yyx990803 May 6, 2021

Author Member

Vite expects index.html to be at project root, and the entry should be linked to using <script type="module">.

Docs: https://vitejs.dev/guide/#index-html-and-project-root

This comment has been minimized.

Copy link
@Rofound

Rofound Apr 3, 2022

pretty good

</body>
</html>
52 changes: 9 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,20 @@
"author": "Evan You <yyx990803@gmail.com>",
"private": true,
"scripts": {
"dev": "node server",
"start": "cross-env NODE_ENV=production node server",
"build": "rimraf dist && npm run build:client && npm run build:server",
"build:client": "cross-env NODE_ENV=production webpack --config build/webpack.client.config.js --progress --hide-modules",
"build:server": "cross-env NODE_ENV=production webpack --config build/webpack.server.config.js --progress --hide-modules",
"postinstall": "npm run build"
},
"engines": {
"node": ">=7.0",
"npm": ">=4.0"
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"compression": "^1.7.1",
"cross-env": "^5.1.1",
"es6-promise": "^4.1.1",
"express": "^4.16.2",
"extract-text-webpack-plugin": "^3.0.2",
"firebase": "4.6.2",
"lru-cache": "^4.1.1",
"route-cache": "0.4.3",
"serve-favicon": "^2.4.5",
"vue": "^2.5.22",
"vue-router": "^3.0.1",
"vue-server-renderer": "^2.5.22",
"vuex": "^3.0.1",
"vue": "^2.6.12",
"vue-router": "^3.0.0",
"vuex": "^3.0.0",
"vuex-router-sync": "^5.0.0"
},
"devDependencies": {
"autoprefixer": "^7.1.6",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-env": "^1.6.1",
"chokidar": "^1.7.0",
"css-loader": "^0.28.7",
"file-loader": "^1.1.5",
"friendly-errors-webpack-plugin": "^1.6.1",
"rimraf": "^2.6.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"sw-precache-webpack-plugin": "^0.11.4",
"url-loader": "^0.6.2",
"vue-loader": "^15.3.0",
"vue-template-compiler": "^2.5.22",
"webpack": "^3.8.1",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.20.0",
"webpack-merge": "^4.2.1",
"webpack-node-externals": "^1.7.2"
"vite-plugin-vue2": "^1.4.4",
"stylus": "^0.54.8",
"vite": "^2.2.3"
}
}
Loading

1 comment on commit 565b948

@yyx990803
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Removed the SSR specific code since the migration build does not support Vue 2 SSR.

    • Removed entry-server.js
    • Merged the api directory into a single client-only api.js file
  • Swapped the build tool from a custom webpack setup to Vite.

Please sign in to comment.