oemer
Explore posts from serversYour feedback, what should I use ? Fork || Layer || Module ?
My rule of thumb:
- Use the reusable source as long as you can (In this case: Nuxt Layers)
- Once you see you have to do too many
if-else
conditions at too many places to satisfy all requirements, copy-paste it (In this case: Fork)5 replies
TTCTheo's Typesafe Cult
•Created by oemer on 10/25/2023 in #questions
` npx create t3-app@latest` returns `npm ERR! could not determine executable to run`
Ok with
pnpm create t3-app@latest
it seems to work now..6 replies
TTCTheo's Typesafe Cult
•Created by oemer on 10/25/2023 in #questions
` npx create t3-app@latest` returns `npm ERR! could not determine executable to run`
running on node
v18.17.1
6 replies
TTCTheo's Typesafe Cult
•Created by oemer on 10/25/2023 in #questions
` npx create t3-app@latest` returns `npm ERR! could not determine executable to run`
Second part of logs:
6 replies
How to fix "[module] is not export by [path]" error during build, when it works on development?
Problem was that my workspaces was using
commonjs
as the target build 🤦♂️ I added a new tsconfig.esm.json
with the correct ESNext
target and now it works even without optimizeDeps
.
@chakraecho I tried to add it to build.transpile
before, but it didn't work.
@🇨🇭 Marko Bolliger <cannap> We will hopefully switch to pnpm soon too 🤞 Sometimes I am just tired of this obscure node eco system 😄 Hope that pnpm gives us some valuable restrictions.6 replies
What is the suggested alternative to layout middlewares in Nuxt 3?
@wypratama Sorry for my late response. And even though it throws no error, it still doesn't work. Nothing happens.
Also I am using
Also I am using
<script lang="ts" setup>
and there you cannot return export default
. But I also tried it without export default
and also using it without script setup notation. No success. I also tried defineComponent
. It doesn't seem to be possible.6 replies
What is the suggested alternative to layout middlewares in Nuxt 3?
Yes, this is definetely not possible. You can see the error page is telling, that it only works for SFC that are also a page. I found that stackoverflow search, but i did not want to use
.global
as stated in my original question. I don't want to call the middleware on every page. And I also don't want to nest my pages in /admin
, thats why I asked here as well.
I ended up using .global
middleware, since I didn't found any alternative. Thanks for your help tho!6 replies
Can i set `.env` file path inside `nuxt.config.ts`?
@Pratham Interesting approach that could fix my problem as well. However - similar to what you said - it's just way safer and future proof to do it in each
package.json
for now. Even if it includes some copy-paste. 😄
We use the .env
-file only for local development. In a staging and production deployment, the environment variables are added to the docker container, no .env
-file there.10 replies
Can i set `.env` file path inside `nuxt.config.ts`?
Interesting approach! I saw the
c12
with setupDotenv
part too in the nuxt code. Was hoping for a defined api instead of a "hacky" like solution.
I guess I will just add --dotenv ../.env
to every script I need. Currently it seems to be the safest and most clean way to accomplish it.10 replies
Can i set `.env` file path inside `nuxt.config.ts`?
Yes that works. But having an option in
nuxt.config.ts
supports DRY principle.
In my case I want to have a base
Layer, which imports all .env
variable. Layers that extend the base
Layer should not have to do this again.
Also I think it's more convenient to have all options available in nuxt.config.ts
that are available in the package.json
, like --dotenv
.10 replies
Do I need to install dependencies of Layers I am extending in a monorepo?
Well, for me "working" would mean: You don't have to do do any aliasing of the packages. But here I have to do the aliasing manually. Meh.
I hoped Layers would help me get cleaner code with less complexity, but here we also have to add some complexity to even use it properly.
6 replies