zeng95 / vue-airbnb-ssr Goto Github PK
View Code? Open in Web Editor NEWAirbnb-Clone (server-side rendering) using Element Plus, Vue 3 along with Vite.
Airbnb-Clone (server-side rendering) using Element Plus, Vue 3 along with Vite.
客户端和服务端编译之后运行prod:ssr报错
报错内容是需要解析不了 ES module 格式
如果作者编译没有问题能不能告诉我 node版本和npm版本
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
hey, really cool project, it really helped me. However, I have a problem in prod. if I build the project with build:ssr
and start it on a server with prod:ssr
, then the axios requests no longer work with the proxy.
The requests are displayed in the network tab but the response is simply the index.html
:
Could it be because I don't use a router? I have removed everything that has to do with routers. However, everything works locally with dev:ssr
.
My package.json
scripts:
"dev:ssr": "cross-env NODE_ENV=development npx node-dev server",
"prod:ssr": "cross-env NODE_ENV=production npx node-dev server",
"build:ssr": "npm run build:client && npm run build:server",
"build:client": "vite build --ssrManifest --outDir dist/client",
"build:server": "vite build --ssr src/entry-server.js --outDir dist/server",
My vite.config.ts
:
import {fileURLToPath, URL} from 'url'
import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd())
return {
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
proxy: {
"/api": {
target: `https://${env.VITE_DASHBOARD_SUB}.${env.VITE_DOMAIN}`,
changeOrigin: true
},
"/tebex": {
target: "https://plugin.tebex.io",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/tebex/, ""),
headers: {
'X-Tebex-Secret': env.VITE_TEBEX_SECRET
}
}
}
},
css: {
preprocessorOptions: {
scss: {
quietDeps: true,
additionalData: `
@use 'aos/dist/aos.css';
@use 'sweetalert2/src/sweetalert2.scss';
@use '@/assets/scss/sweetalert.scss';
@use '@/assets/scss/fonts.scss';
@use '@/assets/scss/slides/slides.scss';
`
}
}
}
}
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.