Comments (11)
Were you able to make your Adonis project work with Inertia 1.0 and especially SSR? Could you please share such project on Github. Perhaps I and others could study and compare the code file by file (or use it as a starter project after cloning) and it will be even better for you not to explain all the things over and over. Because I can't find a working example of Adonis and Inertia 1.0 with SSR. It would be cool if you could create some repo with the basic working example of Adonis and Inertia with SSR, preferably using Vue ;) Just something very basic, one route and one page. Thank you a lot in advance.
from inertiajs-adonisjs.
@jitterbux Please try updating webpack.ssr.config.js
as follows:
const nodeExternals = require('webpack-node-externals');
Then replace
config.externals = [require('webpack-node-externals')()]
with
config.externals = [
nodeExternals({
allowlist: ['@inertiajs/core', '@inertiajs/vue3'],
}),
];
This solved the problem for me.
from inertiajs-adonisjs.
Oh! Makes sense.
from inertiajs-adonisjs.
Hey @jitterbux
Thanks for the feedback. Can you please elaborate on what stopped working for you?
A sample project would be best, but a stack trace is also good.
Keep 2 things in mind though:
- Version 8 is designed to work with inertia V1 and there had been some breaking changes on both ends.
- Since V1 all inertia packages use ESM instead of CJS (
import X from 'Y'
vsconst X = require('Y')
) . You will need to adjust your webpack/encore/vite config accordingly.
from inertiajs-adonisjs.
Yeah, I am stuck at this error message: Instead rename index.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules
so I am not sure how to fix it. It points to this line: module.exports = require("@inertiajs/vue3");
in ssr.js. So, I need to change it to import { } from "@inertiajs/vue3";
? Sorry, I am bad with JavaScript.
from inertiajs-adonisjs.
Thank you @mastermunj I had the same issue but after that I have this error "Cannot use import statement outside a module" (with react)
@eidellev I agree with @jitterbux It's hard to find a working example with ssr ! I saw @RomainLanz trying it on Youtube.
from inertiajs-adonisjs.
I have made it work with Vue and React. I will check if I can improve the readme, but I don't recall having any issues with this package.
The only thing to consider is that you should not use Inertia 1.0 yet.
from inertiajs-adonisjs.
@RomainLanz curious as to why Inertia 1.0 shouldn't be used yet? I thought it's a stable release.
from inertiajs-adonisjs.
Because this package has not been updated for it yet. No issue with Inertia 1.0 directly 😄
from inertiajs-adonisjs.
I have made it work with Vue and React. I will check if I can improve the readme, but I don't recall having any issues with this package.
The only thing to consider is that you should not use Inertia 1.0 yet.
Could you share a "how to"? I am trying to use Adonis + SSR + React but I have not succeeded so far.
from inertiajs-adonisjs.
Could you share a "how to"? I am trying to use Adonis + SSR + React but I have not succeeded so far.
If you want to enable SSR, you have to use version 7.4.0
of this package, and you must code your frontend in CJS.
Using the latest version will move your frontend code to ESM. Doing so will require to also have an ESM backend to render your components/pages, and this is not the case with AdonisJS 5.
TL;DR: If you want to do SSR with AdonisJS 5 and Inertia, use version 7.4.0
and code in CJS.
from inertiajs-adonisjs.
Related Issues (20)
- Using SSR causes : Cannot use 'import.meta' outside a module HOT 3
- [Question] How to set css classes as active on the current link. HOT 2
- Support Inertia 1.0 HOT 7
- Suggested way to infer Params returned HOT 2
- For people unable to make version 8 work, go with 7.4.1 HOT 1
- Authentication is not working properly. HOT 6
- SSR Error HOT 8
- Title Page doesn't Work
- InertiaJS-AdonisJS: App loading as a single component HOT 3
- const root = document.getElementById('app') return null HOT 1
- just a idea you can ignore
- Documentation Update - Include Non-SSR Setup Instructions - import.meta and official inertiaJS docs. HOT 2
- ssr server not up HOT 2
- Error when trying to lift an ssr server HOT 6
- Use qs to preserve querystring HOT 2
- AdonisJS 6 Support HOT 13
- SSR: images seem to have incorrect path
- Pinia does not initialize in project with inertiajs, vue and adonisjs HOT 4
- Login Flash messages not working with Exception redirect
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 inertiajs-adonisjs.