#why can I see all the source code under sources?
44 messages · Page 1 of 1 (latest)
Based on the information provided in the knowledge sources, I can address your concern about seeing the entire source code of your application, including TypeScript types, in the Sources tab. This is related to sourcemaps, which are used for debugging purposes.
Sourcemaps are enabled by default for the server build and in development mode for the client build. This allows developers to debug their code more easily by mapping the compiled code back to the original source code. However, you're right to be concerned about this in a production environment.
To address this security concern, you can configure the sourcemap settings in your Nuxt configuration. Here's how you can disable or optimize sourcemaps:
- You can disable sourcemaps completely by setting them to
falsein yournuxt.config.tsfile:
export default defineNuxtConfig({
sourcemap: false
})
- Alternatively, you can set sourcemaps to
hidden, which is now supported in Nuxt. This will generate sourcemaps but not expose them publicly:
export default defineNuxtConfig({
sourcemap: {
server: 'hidden',
client: 'hidden'
}
})
Nuxt Configuration (https://nuxt.com/docs/api/nuxt-config#sourcemap) provides more details on sourcemap configuration options.
By configuring sourcemaps appropriately, you can prevent your full source code from being visible in the Sources tab, addressing the security concern you've raised.
Remember to always be cautious with sensitive information and ensure that your production builds are properly optimized and secured.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@uncut grail Kapa.ai is still learning and improving, please let me know how I did by reacting below.
but I still need it for the sentry module...
this is how frontend frameworks operate, vue templates are parsed on the client/browser side
nothing we can do about it?
do about what?
thats a missleading answer, because thats not how vue operates.
for example: nuxt.com shows everything minfied.
vue needs the vue templates to render them
how are you deploying?
nuxi build?
that doesn't deploy..
what do you mean how am I deploying?
how is your application running on your server
docker builds everything and then deployed to cloudflare
ENTRYPOINT ["node", "./server/index.mjs"]
the files you're pointing at on nuxt.com are the same thing as vue components just not sfc
exactly! in my app I can literally see everything. not minified, and organized by folders, also I can even see typescript code (which should be excluded in build time)
i'm not sure why your deployment is that way - what is "packages" ?
that's non-standard as far as i know
thats a big monorepo, devided to 2 sites
using nuxt layers
thats why I have 'packages' folders
so your layers are the things that are vue files, not your app
```bash
root/
│
├── apps/
│ └── base/
│ └── site-1/
│ └── site-2/
│
├── packages/
│ ├── ui/
│ ├── funds/
│ └── ...
│
├── package.json
└── tsconfig.json
thats how my app looks like
i'm not sure how packages is expected to work on this, never seen that before
just using nuxt layers. but in a monorepo convention.
but packages is not a standard nuxt folder
i'll send a reference
i imagine it has something to do with nuxt and/or the build process not knowing it needs to process that folder
looks like it is just using raw vue components from directories
thats what im saying... something's wrong
and the funny part is that the site also has the minified version as well.......
idk it looks like you're running the dev process on your site
maybe its has something to do with the source maps configuration?
i've tried w/ remote layers on github and local layers and that's not happening on my setup
when you build and run locally does it happen?
just tried that, and it does
Okay, just found the issue and thats the sourcemaps configuarion...