Comments (6)
Ok, I see, and it makes sense.
The only thing I'm worried about is if we start to have too many variations than a file-based generator may show its limits.
But, ok, let's go with your proposal and see how far we can get. (I expect far enough for now.)
Long term, maybe the answer will end up being some kind of hybrid approach. We'll see.
Exciting :-).
from create-vite-plugin-ssr.
As for the multiple _error.page.js
problem, would it be possible to a different Vite root for each framework? Seems like the canonical & right approach?
from create-vite-plugin-ssr.
As for the multiple
_error.page.js
problem, would it be possible to a different Vite root for each framework? Seems like the canonical & right approach?
I'm not sure. This is just a problem on the boilerplate dev
environment. To serve we do not use vite serve / vite dev server
, but ts-node
.
"dev:react": "cross-env VITE_APP_FRAMEWORK=React ts-node --project ./template-react/tsconfig.json ./shared/server",
As I understand on the docs you can only specify a different root with vite serve some/sub/dir
or for multi-page-app rollupOptions.input
.
Do you have an idea how to set this up with ts-node
or any alternative idea?
Edit: I found this issue. I will try the suggested answers.
So I could not get it to work. What I tried:
resolve: {
alias: {
'@create-vite-plugin-ssr/shared': resolve(__dirname, './shared'),
'@create-vite-plugin-ssr/template-preact': resolve(__dirname, './template-preact'),
'@create-vite-plugin-ssr/template-react': resolve(__dirname, './template-react'),
'@create-vite-plugin-ssr/template-vue': resolve(__dirname, './template-vue')
}
},
build: {
rollupOptions: {
input: {
VITE_APP_FRAMEWORK: resolve(__dirname, `./template-${VITE_APP_FRAMEWORK.toLowerCase()}/renderer/_default.page.server.tsx`)
}
},
lib: {
entry: `./template-${VITE_APP_FRAMEWORK.toLowerCase()}/renderer/_default.page.server.tsx`,
name: VITE_APP_FRAMEWORK
},
target: 'esnext',
format: 'esm'
}
The problem is, when you reload the page (so call server side routing, not client side), vps is throwing the error:
Error: [vite-plugin-ssr@0.3.64][Wrong Usage] Only one `_error.page.js` is allowed. Found several: /template-preact/renderer/_error /template-react/renderer/_error /template-vue/renderer/_error
It is still including the pages in _allPageFiles.page
:
[
{
"filePath": "/template-preact/renderer/_error.page.tsx"
},
{
"filePath": "/template-react/renderer/_error.page.tsx"
},
{
"filePath": "/template-vue/renderer/_error.page.vue"
},
{
"filePath": "/template-preact/pages/about/index.page.tsx"
},
{
"filePath": "/template-preact/pages/index/index.page.tsx"
},
{
"filePath": "/template-react/pages/about/index.page.tsx"
},
{
"filePath": "/template-react/pages/index/index.page.tsx"
},
{
"filePath": "/template-vue/pages/about/index.page.vue"
},
{
"filePath": "/template-vue/pages/index/index.page.vue"
}
]
from create-vite-plugin-ssr.
How about we dev only one framework at a time and set vite.config.js#root
accordingly?
from create-vite-plugin-ssr.
How about we dev only one framework at a time and set
vite.config.js#root
accordingly?
I'll give it a try. Maybe there is something wrong with the monorepo or ts setup. For testing I will create a new repo and build everything from ground up just with minimal setup to the point I can run dev, else its hard to debug.
from create-vite-plugin-ssr.
I got it working and pushed the new setup to repo! Check the new readme and have fun reviewing the new code
from create-vite-plugin-ssr.
Related Issues (7)
- Directory Conflict Resolving HOT 8
- MVP
- Scaffolding Logic HOT 16
- CLI selectOption conditions HOT 1
- Monorepo architecture HOT 3
- Use Vitest HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from create-vite-plugin-ssr.