Static files deployed and showing in source console in Expo web

Please provide the following:

  1. SDK Version: ~44.0.0
  2. Platforms(Android/iOS/web/all): web

Hi, my question to all the community people who are using the expo web extensively, so every time I was trying to deploy the application the whole static folder, as well as the whole codebase, is showing under the inspect → source. Can anyone please help me out with this?
These are the build scripts that I am using in the project package.json:
{

“scripts”: {
“start”: “expo start”,
“android”: “expo start --android”,
“ios”: “expo start --ios”,
“web”: “yarn expo start --web”,
“eject”: “expo eject”,
“build”: “rm -rf web-build && yarn expo build:web”,
“deploy”: “yarn build && cd web-build && vercel --prod”
},

}

@cavishek I have the same issue. Did you come up with a fix?

Hi @meta1, nope not yet. Can you share your code base with me, or maybe the package.json file, I wanted to study that?

@cavishek Unfortunately my customer will not allow us to share the full code base.

Here is the relevant part of the package.json file.

  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "lint": "yarn eslint --ext '.js,.ts' ./src"
  },

@cavishek In my case, I am deploying with AWS Amplify. I believe that the issue is related to the source map files.

https://github.com/facebook/create-react-app/issues/2005

https://docs.sentry.io/platforms/javascript/sourcemaps/

https://stackoverflow.com/questions/51415780/create-react-app-is-showing-all-my-code-in-production-how-to-hide-it

I have a bit of a catch-22… If I understand this correctly, the browser will load the source maps when you open devtools. It appears that you can remove these map files after build or set an environment variable to cause them not to be generated. That being said, I need the source map files to be generated and uploaded to sentry.

If I am on the right track, this will take some experimentation with the Sentry and Amplify settings.

Here is the contents of my amplify.yml

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
        - nvm install 16
        - nvm use 16
        - npm install --quiet --global expo-cli
        - >
          if [ -f yarn.lock ]; then
           yarn
          elif [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
           npm ci
          else
           npm install
          fi
    build:
      commands:
        - 'expo build:web'
  artifacts:
    baseDirectory: web-build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
      - $(npm root --global)/**/*

Alright, that’s cool. Let me check those stuff, I will get back to you soon.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.