Hermes Alves
Hermes Alves
Explore posts from servers
NNuxt
Created by Hermes Alves on 11/14/2024 in #❓・help
Nuxt 4 - compability version (node:81791) Warning: To load an ES module, set "type": "module" in...
{
"name": "studio",
"type": "module",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"lint": "eslint . --ext .vue,.js,.ts",
"lint:fix": "eslint . --fix --ext .vue,.js,.ts"
},
{
"name": "studio",
"type": "module",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"lint": "eslint . --ext .vue,.js,.ts",
"lint:fix": "eslint . --fix --ext .vue,.js,.ts"
},
Hello everyone, I'm encountering an issue while building a Nuxt 3.14.159 project using Bun. The build process fails with the following error:
[10:37:04 AM] ERROR (node:81791) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)

[10:37:04 AM] ERROR (node:81791) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
[10:37:04 AM] ERROR (node:81791) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)

[10:37:04 AM] ERROR (node:81791) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
The package.json includes "type": "module". The nuxt.config.ts specifies compatibilityVersion: 4 and compatibilityDate: '2024-04-03'.
8 replies
NNuxt
Created by Hermes Alves on 10/26/2024 in #❓・help
How to Add Dynamic Pages/Extensions in Nuxt 4 at Runtime? Need Ideas for My Bun-based Open project
Hey everyone, I'm working on a backend, and the API and data management is being done with Nuxt (compatibility mode for version 4). I could use some help with architecting a part of the system where users can add new pages or even a new application, inheriting from the existing app/core in Nuxt 4. Initially, I thought about using layers, but it turns out that inserting layouts via nuxt.config.ts doesn't allow for this to be done at runtime. Has anyone faced something similar or have ideas on how to solve this? Here's a quick overview of the project, which is built with Bun using bun workspaces:
**back3nd**:
packages
api (Hono)
studio (Nuxt 4)
prisma
**back3nd**:
packages
api (Hono)
studio (Nuxt 4)
prisma
The idea is that through the studio interface, users can create new tables in the database, and the API is automatically generated with Hono. It's similar to Directus, but due to licensing issues, I can't use Directus in my open-source project, so I'm building my own solution. My current challenge is to create a way to support dynamic extensions inside studio at runtime. Do you think a plugin-based approach with Nitro could work? Or is there another strategy you'd suggest to handle this? I appreciate any ideas or experiences you can share! 🙏 Repo link: https://github.com/back3nd-team
7 replies
DDeno
Created by Hermes Alves on 10/15/2024 in #help
Why isn't the API_PORT variable being loaded? Is there something I'm missing?
I'm trying to load an environment variable API_PORT using Deno and the @std/dotenv module, but it’s not being loaded correctly. The variable is undefined when I try to access it with Deno.env.get('API_PORT'). Here’s the code:
import { Hono } from '@hono/hono';
import { load } from "@std/dotenv"
const envVar = await load();

const app = new Hono();
console.log('PORT? ', Deno.env.get('API_PORT'), envVar);
app.get('/', (c) => c.text('Hello Deno!'));
const port = parseInt(Deno.env.get('API_PORT') || '8080');

Deno.serve({ port: port}, app.fetch);
import { Hono } from '@hono/hono';
import { load } from "@std/dotenv"
const envVar = await load();

const app = new Hono();
console.log('PORT? ', Deno.env.get('API_PORT'), envVar);
app.get('/', (c) => c.text('Hello Deno!'));
const port = parseInt(Deno.env.get('API_PORT') || '8080');

Deno.serve({ port: port}, app.fetch);
Why isn't the API_PORT variable being loaded? Is there something I'm missing?
15 replies
NNuxt
Created by Hermes Alves on 2/23/2024 in #❓・help
Losing Session on F5 (Reload) with Middleware and Pinia in a Nuxt.js Application
No description
1 replies
CDCloudflare Developers
Created by Hermes Alves on 11/27/2023 in #general-help
typescript sdk for KV?
Could you tell me if there is a taipescript SDK for kv because I couldn't find it. Just the rest API endpoint I found it.
11 replies
NNuxt
Created by Hermes Alves on 11/20/2023 in #❓・help
localhost:3000/api/analytics import it's not accepted? @google-analytics/data
[13:05:34] ERROR Cannot resolve "unenv/runtime/node/string_decoder/index/" from "/home/xxx/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js" and externals are not allowed! Localhost work's fine. But deploy for cloudflare pages didn't work:
import { BetaAnalyticsDataClient } from '@google-analytics/data'
import { ga } from '@/config/ganalytics.config'
export default defineEventHandler(async (event) => {
const propertyId = ga.property_id

const analyticsDataClient = new BetaAnalyticsDataClient({
credentials: {
client_email: ga.client_email,
private_key: ga.private_key?.replace(/\n/gm, '\n'), //
},
})
async function getServiceReport() {
const [response] = await analyticsDataClient.runReport({
property: `properties/${propertyId}`,
dateRanges: [
{
startDate: `7daysAgo`, //:point_left: e.g. "7daysAgo" or "30daysAgo"
endDate: 'today',
},
],
dimensions: [
{
name: 'fullPageUrl', // data will be year wise
},
],
metrics: [
{
name: 'screenPageViews', // it returs the active users
},
],
metricAggregations: ['TOTAL'],
})
return response
}
const data = await getServiceReport()
return {
hello: data,
}
})
import { BetaAnalyticsDataClient } from '@google-analytics/data'
import { ga } from '@/config/ganalytics.config'
export default defineEventHandler(async (event) => {
const propertyId = ga.property_id

const analyticsDataClient = new BetaAnalyticsDataClient({
credentials: {
client_email: ga.client_email,
private_key: ga.private_key?.replace(/\n/gm, '\n'), //
},
})
async function getServiceReport() {
const [response] = await analyticsDataClient.runReport({
property: `properties/${propertyId}`,
dateRanges: [
{
startDate: `7daysAgo`, //:point_left: e.g. "7daysAgo" or "30daysAgo"
endDate: 'today',
},
],
dimensions: [
{
name: 'fullPageUrl', // data will be year wise
},
],
metrics: [
{
name: 'screenPageViews', // it returs the active users
},
],
metricAggregations: ['TOTAL'],
})
return response
}
const data = await getServiceReport()
return {
hello: data,
}
})
What did I do wrong?
4 replies
CDCloudflare Developers
Created by Hermes Alves on 8/30/2023 in #pages-help
Setting Up Custom Domains for Different Branches in Cloudflare Pages
No description
6 replies
CDCloudflare Developers
Created by Hermes Alves on 8/9/2023 in #pages-help
A git repository for multiple pages? /workers-and-pages
I have only ONE code, in ONE repository on github. There are four (4) sites, with the same code, what changes is the backend, via environment variables. Is there a way I can point 4 domains, to put 4 sites online with different backends? The backend I provide in the environment variable, however it only has TWO (2) environments, production and test, I need more. How would I do this in cloudflare workers-and-pages?
1 replies
NNuxt
Created by Hermes Alves on 4/11/2023 in #❓・help
TWA or Android App, how can build one?
I found a article about generating Trusted Web Activity from Nuxt.js app, but only for nuxt 2. This is possible make a TWA for Nuxt 3? https://blog.logrocket.com/how-to-build-a-twa-android-app-out-of-your-nuxt-js-pwa/
2 replies
NNuxt
Created by Hermes Alves on 3/21/2023 in #❓・help
How can i use the named slot templates with default layout?
Only home is a different layout, all the internals of the site are the same, so I would like to use: <NuxtLayout name="home"> for initial, but in the internals I would like to use the default layout. But it doesn't work: <template #preContent> <div class="sum-class"> SomeContent here </div> </template>
1 replies
NNuxt
Created by Hermes Alves on 3/6/2023 in #❓・help
Dev mode or production mode? How can check it?
Any way to test within the nuxt 3 app if I'm in dev or production mode?
6 replies
NNuxt
Created by Hermes Alves on 3/4/2023 in #❓・help
Video guide about create a nuxt module? #tutorial
Could you recommend articles that teach me how to create modules with nuxt 3?
1 replies
NNuxt
Created by Hermes Alves on 2/16/2023 in #❓・help
How can i set root component an explicit name?
No description
1 replies
NNuxt
Created by Hermes Alves on 1/6/2023 in #❓・help
May i access useRuntimeConfig from a composable.ts file?
No description
2 replies
NNuxt
Created by Hermes Alves on 1/6/2023 in #❓・help
NuxtLoadingIndicator duplicate my layout? I'm using NuxtLoadingIndicator inside app.vue
Hi there, I have the layout/default.vue I was using loading within the layout, and I was replicating the layout. They had two menus, for example. Now I'm using it inside app.vue and it doesn't replicate the home page but it replicates the other pages. Weird. How do I prevent it from replicating?
1 replies
NNuxt
Created by Hermes Alves on 12/31/2022 in #❓・help
cypress test with gilab-ci? Can´t visit localhost300
No description
1 replies