Reputation: 31
Next.js is sending my source files to the browser so they are easily accessible to anyone via devtools in the browser. This is a problem because those files contain getServerSideProps
functions with my api keys.
Any help would be appreciated.
Upvotes: 0
Views: 1711
Reputation: 31
Figured it out!
You have to add productionBrowserSourceMaps: false
in next.config.js
then run npm run build
, and them npm run start
, the source maps will be gone in production. They will still appear if you run npm run dev
, but they won't in production.
Hope I helped someone.
Upvotes: 2