expo build:web entry point not found

Hey Folks,

NOOB to building an expo web app. I’m trying to build a docker container with my expo web app. After I run “expo build:web” and the build successfully finishes, I cannot find the entry point in the web-build folder.

I have a custom entry point defined in my app.json: “entryPoint”: “./index.js”,

But the web-build folder has neither the index.js nor an App.js that I can find.

When I run the app in the docker container and connect to http://localhost:19006 I get:

./node_modules/expo/AppEntry.js:3
Module not found: Can't resolve '../../App'

I am missing something simple, I know it. Can you help?

Thanks!

BTW, I can see the entry point defined in the “asset-manifest.json” file. But I don’t know the steps to call that as my starting point and why it’s trying to use “../../App” instead.

Here is my Dockerfile if it helps:

FROM node:12.20.2 as build

ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

ARG PORT=19006
ENV PORT $PORT
EXPOSE $PORT 19001 19002

ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH /home/node/.npm-global/bin:$PATH
RUN npm i --unsafe-perm -g npm@latest expo-cli@latest

RUN mkdir /opt/my-app && chown node:node /opt/my-app
WORKDIR /opt/my-app
ENV PATH /opt/my-app/.bin:$PATH
USER node

COPY package.json ./
COPY .env.production ./.env
COPY ./private ./private

RUN yarn install --silent

WORKDIR /opt/my-app/app
COPY ./web-build .

ENTRYPOINT ["npm", "run"]
CMD ["web"]

I figured it out!

In my package.json file, I had the line:

"main": "node_modules/expo/AppEntry.js",

I changed it to:

"main": "index.js",

This worked in yarn start mode but not in production so I never gave it another look.

I also had to change the docker file a little by using “serve”:

FROM node:12.20.2 as build

ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

ARG PORT=19006
ENV PORT $PORT
EXPOSE $PORT 19001 19002

ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH /home/node/.npm-global/bin:$PATH
RUN npm i --unsafe-perm -g npm@latest expo-cli@latest serve

RUN mkdir /opt/web && chown node:node /opt/web
WORKDIR /opt/web
ENV PATH /opt/web/.bin:$PATH
USER node

COPY package.json ./
COPY .env.production ./.env
COPY ./private ./private

RUN yarn install --silent
RUN ls -al

WORKDIR /opt/web/app
COPY ./web-build .
RUN ls -al

CMD ["serve","--no-port-switching","-p","19006"]
2 Likes

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