Created
January 7, 2024 09:32
-
-
Save hphuocthanh/df8cb7b0c93b945884deb16e6791eb63 to your computer and use it in GitHub Desktop.
AWS Amplify React Vite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1 | |
backend: | |
phases: | |
build: | |
commands: | |
- ln -fs /usr/local/bin/pip3.8 /usr/bin/pip3 | |
- ln -fs /usr/local/bin/python3.8 /usr/bin/python3 | |
- pip3 install --user pipenv | |
- amplifyPush --simple | |
frontend: | |
phases: | |
preBuild: | |
commands: | |
- nvm use 18 | |
- yarn install | |
build: | |
commands: | |
- yarn run build | |
artifacts: | |
baseDirectory: build | |
files: | |
- '**/*' | |
cache: | |
paths: | |
- node_modules/**/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
declare module './aws-exports' { | |
const awsExports: unknown | never | |
export default awsExports | |
} | |
export = awsmobile | |
declare const awsmobile: any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import ReactDOM from 'react-dom/client' | |
import App from './App.tsx' | |
import './index.css' | |
import { Amplify } from 'aws-amplify' | |
import awsExports from './aws-exports' | |
Amplify.configure(awsExports) | |
ReactDOM.createRoot(document.getElementById('root')!).render( | |
<React.StrictMode> | |
<App /> | |
</React.StrictMode> | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "ES2020", | |
"useDefineForClassFields": true, | |
"lib": ["ES2020", "DOM", "DOM.Iterable"], | |
"module": "ESNext", | |
"skipLibCheck": true, | |
/* Bundler mode */ | |
"moduleResolution": "bundler", | |
"allowImportingTsExtensions": true, | |
"resolveJsonModule": true, | |
"isolatedModules": true, | |
"noEmit": true, | |
"jsx": "react-jsx", | |
/* Linting */ | |
"strict": true, | |
"noUnusedLocals": true, | |
"noUnusedParameters": true, | |
"noFallthroughCasesInSwitch": true | |
}, | |
"include": ["src"], | |
"references": [{ "path": "./tsconfig.node.json" }] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineConfig } from 'vite' | |
import react from '@vitejs/plugin-react' | |
// https://vitejs.dev/config/ | |
export default defineConfig({ | |
plugins: [react()], | |
resolve: { | |
alias: [ | |
{ | |
find: './runtimeConfig', | |
replacement: './runtimeConfig.browser', | |
}, | |
], | |
}, | |
//Add build if you are going to use a Git-based (Github or CodeCommit) deployement | |
build: { | |
outDir: 'build', | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment