Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure vite bundler #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
>= 0.5%
last 4 major versions
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tailwind.config.js
postcss.config.js
.eslintrc.js
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.bak

# cache
.eslintcache
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Development process tracking app" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Marathon</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/App.tsx"></script>
</body>
</html>
45,192 changes: 9,813 additions & 35,379 deletions package-lock.json

Large diffs are not rendered by default.

59 changes: 21 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,46 @@
"name": "marathon",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vite --debug",
"build": "tsc && vite build --debug",
"serve": "vite preview",
"lint": "eslint --cache --fix ."
},
"dependencies": {
"@aws-sdk/client-cognito-identity-provider": "^3.121.0",
"@aws-sdk/client-dynamodb": "^3.113.0",
"@aws-sdk/credential-provider-cognito-identity": "^3.121.0",
"@aws-sdk/credential-providers": "^3.121.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"@aws-sdk/client-cognito-identity-provider": "^3.137.0",
"@aws-sdk/client-dynamodb": "^3.137.0",
"@aws-sdk/credential-provider-cognito-identity": "^3.137.0",
"@aws-sdk/credential-providers": "^3.137.0",
"@types/jest": "^27.5.2",
"@types/react": "^18.0.11",
"@types/react-dom": "^18.0.5",
"and": "^0.0.3",
"daisyui": "^2.18.0",
"npm": "^8.13.2",
"nth-check": ">=2.0.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.1",
"start": "^5.1.0",
"typescript": "^4.7.3",
"web-vitals": "^2.1.4"
},
"scripts": {
"lint": "eslint --fix \"./**/*.{ts,tsx}\"",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@tailwindcss/forms": "^0.5.2",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.30.6",
"@typescript-eslint/parser": "^5.30.6",
"@vitejs/plugin-react": "^2.0.0",
"autoprefixer": "^10.4.7",
"eslint": "^8.19.0",
"eslint-plugin-react": "^7.30.1",
"postcss": "^8.4.14",
"tailwindcss": "^3.0.24"
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-polyfill-node": "^0.10.2",
"tailwindcss": "^3.0.24",
"vite": "^3.0.0",
"vite-tsconfig-paths": "^3.5.0"
}
}
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
};
8 changes: 4 additions & 4 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
content: [
'./src/**/*.{js,jsx,ts,tsx}',
],
theme: {
extend: {},
},
plugins: [
require('@tailwindcss/forms'),
require("daisyui"),
require('daisyui'),
],
}
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ESNext",
"lib": [
"dom",
"dom.iterable",
Expand Down
95 changes: 95 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill';
import rollupNodePolyFill from 'rollup-plugin-node-polyfills';
import rollupPolyfillNode from 'rollup-plugin-polyfill-node';

export default defineConfig({
plugins: [react()],
server: {
port: 3001,
open: true
},
resolve: {
// alias: {
// // // This Rollup aliases are extracted from @esbuild-plugins/node-modules-polyfill,
// // // see https://github.com/remorses/esbuild-plugins/blob/master/node-modules-polyfill/src/polyfills.ts
// util: 'rollup-plugin-node-polyfills/polyfills/util',
// events: 'rollup-plugin-node-polyfills/polyfills/events',
// stream: 'rollup-plugin-node-polyfills/polyfills/stream',
// path: 'rollup-plugin-node-polyfills/polyfills/path',
// querystring: 'rollup-plugin-node-polyfills/polyfills/qs',
// url: 'rollup-plugin-node-polyfills/polyfills/url',
// string_decoder: 'rollup-plugin-node-polyfills/polyfills/string-decoder',
// http: 'rollup-plugin-node-polyfills/polyfills/http',
// buffer: 'rollup-plugin-node-polyfills/polyfills/buffer-es6',
// process: 'rollup-plugin-node-polyfills/polyfills/process-es6',
// // Not included in `rollup-plugin-node-polyfills`.
// // os: 'rollup-plugin-node-polyfills/polyfills/os',
// os: 'rollup-plugin-node-polyfills/polyfills/os',
// // os: 'rollup-plugin-polyfill-node',
// // sys: 'util',
// // punycode: 'rollup-plugin-node-polyfills/polyfills/punycode',
// // https: 'rollup-plugin-node-polyfills/polyfills/http',
// // assert: 'rollup-plugin-node-polyfills/polyfills/assert',
// // constants: 'rollup-plugin-node-polyfills/polyfills/constants',
// // _stream_duplex:
// // 'rollup-plugin-node-polyfills/polyfills/readable-stream/duplex',
// // _stream_passthrough:
// // 'rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough',
// // _stream_readable:
// // 'rollup-plugin-node-polyfills/polyfills/readable-stream/readable',
// // _stream_writable:
// // 'rollup-plugin-node-polyfills/polyfills/readable-stream/writable',
// // _stream_transform:
// // 'rollup-plugin-node-polyfills/polyfills/readable-stream/transform',
// // timers: 'rollup-plugin-node-polyfills/polyfills/timers',
// // console: 'rollup-plugin-node-polyfills/polyfills/console',
// // vm: 'rollup-plugin-node-polyfills/polyfills/vm',
// // zlib: 'rollup-plugin-node-polyfills/polyfills/zlib',
// // tty: 'rollup-plugin-node-polyfills/polyfills/tty',
// // domain: 'rollup-plugin-node-polyfills/polyfills/domain',
// },
alias: {
util: 'rollup-plugin-polyfill-node',
events: 'rollup-plugin-polyfill-node',
stream: 'rollup-plugin-polyfill-node',
// path: 'rollup-plugin-polyfill-node', // 'extname' is not exported by `path`
path: 'rollup-plugin-node-polyfills/polyfills/path', // 'posix' is not exported by
querystring: 'rollup-plugin-polyfill-node',
url: 'rollup-plugin-polyfill-node',
string_decoder: 'rollup-plugin-polyfill-node',
http: 'rollup-plugin-polyfill-node',
buffer: 'rollup-plugin-polyfill-node',
process: 'rollup-plugin-polyfill-node',
os: 'rollup-plugin-polyfill-node'
},
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true
}),
NodeModulesPolyfillPlugin()
]
}
},
build: {
rollupOptions: {
plugins: [
// Enable rollup polyfills plugin
// used during production bundling
rollupNodePolyFill(),
malex37 marked this conversation as resolved.
Show resolved Hide resolved
rollupPolyfillNode(),
]
}
}
});