How to import json file from a AWS Lambda Layer in Typescript

Hi, I have a json file in a layer and want to require this json file in my handler.ts like this const firebaseCret = require('/opt/credentials/serviceAccount.json');

But when I run sls deploy, it throws ERROR in ./src/hello.ts Module not found: Error: Can't resolve '/opt/serviceAccount.json' in '/Users/haoyuantang/Projects/ShuanDanTV/Project/src' @ ./src/hello.ts 3:0-57 27:42-54.

Here is my serverless.ts, by the way, can I change it to use .yml?
import type { Serverless } from ‘serverless/aws’;

const serverlessConfiguration: Serverless = {
  service: {
    name: 'shuandantv',
    // app and org for use with dashboard.serverless.com
    // app: your-app-name,
    // org: your-org-name,
  },
  frameworkVersion: '>=1.72.0',
  custom: {
    webpack: {
      webpackConfig: './webpack.config.js',
      includeModules: true
    }
  },
  // Add the serverless-webpack plugin
  plugins: ['serverless-webpack'],
  provider: {
    name: 'aws',
    runtime: 'nodejs12.x',
    apiGateway: {
      minimumCompressionSize: 1024,
    },
    environment: {
      AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
    },
  },
  layers: {
    credentials: {
      path: 'layers/credentials',
      description: 'A layer that contains the main credentials.'
    }
  },
  functions: {
    hello: {
      handler: 'src/hello.hello',
      events: [
        {
          http: {
            method: 'get',
            path: 'hello',
          }
        }
      ]
    },
    hello2: {
      handler: 'src/testmongo.hello2',
      events: [
        {
          http: {
            method: 'get',
            path: 'hello2',
          }
        }
      ]
    }
  }
}

module.exports = serverlessConfiguration;

I assume the error is because /opt is actually on the cloud, so when the program is built, it fails to find this path.

How should I fix this problem? Thanks.