mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-11-20 06:49:52 +01:00
Replace Webpack to Vite (#1023)
* Add vite, typescript and prettier * Configure vite * Fix tsconfig error * Fix manifest json * Move manifest json to root * Bug fix * Move back manifest json to public
This commit is contained in:
parent
63cb564818
commit
899a89cb3b
18 changed files with 1111 additions and 7628 deletions
|
@ -1,5 +1,2 @@
|
||||||
webpack.common.js
|
|
||||||
webpack.dev.js
|
|
||||||
webpack.prod.js
|
|
||||||
experiment
|
experiment
|
||||||
node_modules
|
node_modules
|
35
.eslintrc.js
35
.eslintrc.js
|
@ -4,25 +4,56 @@ module.exports = {
|
||||||
es2021: true,
|
es2021: true,
|
||||||
},
|
},
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:react/recommended',
|
"eslint:recommended",
|
||||||
|
"plugin:react/recommended",
|
||||||
|
"plugin:react-hooks/recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
'airbnb',
|
'airbnb',
|
||||||
|
'prettier',
|
||||||
],
|
],
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
jsx: true,
|
jsx: true,
|
||||||
},
|
},
|
||||||
ecmaVersion: 12,
|
ecmaVersion: 'latest',
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
'react',
|
'react',
|
||||||
|
'@typescript-eslint'
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'linebreak-style': 0,
|
'linebreak-style': 0,
|
||||||
'no-underscore-dangle': 0,
|
'no-underscore-dangle': 0,
|
||||||
|
|
||||||
|
"import/prefer-default-export": "off",
|
||||||
|
"import/extensions": "off",
|
||||||
|
"import/no-unresolved": "off",
|
||||||
|
"import/no-extraneous-dependencies": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
devDependencies: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'react/no-unstable-nested-components': [
|
'react/no-unstable-nested-components': [
|
||||||
'error',
|
'error',
|
||||||
{ allowAsProps: true },
|
{ allowAsProps: true },
|
||||||
],
|
],
|
||||||
|
"react/jsx-filename-extension": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
extensions: [".tsx", ".jsx"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
"react/require-default-props": "off",
|
||||||
|
"react/jsx-props-no-spreading": "off",
|
||||||
|
"react-hooks/rules-of-hooks": "error",
|
||||||
|
"react-hooks/exhaustive-deps": "error",
|
||||||
|
|
||||||
|
"@typescript-eslint/no-unused-vars": "error",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
6
.prettierignore
Normal file
6
.prettierignore
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
dist
|
||||||
|
node_modules
|
||||||
|
package.json
|
||||||
|
package-lock.json
|
||||||
|
LICENSE
|
||||||
|
README.md
|
4
.prettierrc.json
Normal file
4
.prettierrc.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"printWidth": 100,
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
|
||||||
|
}
|
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"typescript.tsdk": "node_modules/typescript/lib"
|
||||||
|
}
|
101
index.html
Normal file
101
index.html
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Cinny</title>
|
||||||
|
<meta name="name" content="Cinny" />
|
||||||
|
<meta name="author" content="Ajay Bura" />
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="A Matrix client where you can enjoy the conversation using simple, elegant and secure interface protected by e2ee with the power of open source."
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
name="keywords"
|
||||||
|
content="cinny, cinnyapp, cinnychat, matrix, matrix client, matrix.org, element"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<meta property="og:title" content="Cinny" />
|
||||||
|
<meta property="og:url" content="https://cinny.in" />
|
||||||
|
<meta property="og:image" content="https://cinny.in/assets/favicon-48x48.png" />
|
||||||
|
<meta
|
||||||
|
property="og:description"
|
||||||
|
content="A Matrix client where you can enjoy the conversation using simple, elegant and secure interface protected by e2ee with the power of open source."
|
||||||
|
/>
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
|
||||||
|
<link id="favicon" rel="shortcut icon" href="./public/favicon.ico" />
|
||||||
|
|
||||||
|
<link rel="manifest" href="./manifest.json" />
|
||||||
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="application-name" content="Cinny" />
|
||||||
|
<meta name="apple-mobile-web-app-title" content="Cinny" />
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
|
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="57x57"
|
||||||
|
href="./public/res/apple/apple-touch-icon-57x57.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="60x60"
|
||||||
|
href="./public/res/apple/apple-touch-icon-60x60.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="72x72"
|
||||||
|
href="./public/res/apple/apple-touch-icon-72x72.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="76x76"
|
||||||
|
href="./public/res/apple/apple-touch-icon-76x76.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="114x114"
|
||||||
|
href="./public/res/apple/apple-touch-icon-114x114.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="120x120"
|
||||||
|
href="./public/res/apple/apple-touch-icon-120x120.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="144x144"
|
||||||
|
href="./public/res/apple/apple-touch-icon-144x144.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="152x152"
|
||||||
|
href="./public/res/apple/apple-touch-icon-152x152.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="167x167"
|
||||||
|
href="./public/res/apple/apple-touch-icon-167x167.png"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="apple-touch-icon"
|
||||||
|
sizes="180x180"
|
||||||
|
href="./public/res/apple/apple-touch-icon-180x180.png"
|
||||||
|
/>
|
||||||
|
</head>
|
||||||
|
<body id="appBody">
|
||||||
|
<script>
|
||||||
|
window.global ||= window;
|
||||||
|
</script>
|
||||||
|
<div id="root"></div>
|
||||||
|
<audio id="notificationSound">
|
||||||
|
<source src="./public/sound/notification.ogg" type="audio/ogg" />
|
||||||
|
</audio>
|
||||||
|
<audio id="inviteSound">
|
||||||
|
<source src="./public/sound/invite.ogg" type="audio/ogg" />
|
||||||
|
</audio>
|
||||||
|
<script type="module" src="./src/index.jsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
8266
package-lock.json
generated
8266
package-lock.json
generated
File diff suppressed because it is too large
Load diff
46
package.json
46
package.json
|
@ -7,8 +7,13 @@
|
||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack serve --config ./webpack.dev.js --open",
|
"start": "vite",
|
||||||
"build": "webpack --config ./webpack.prod.js"
|
"build": "vite build",
|
||||||
|
"lint": "yarn check:eslint && yarn check:prettier",
|
||||||
|
"check:eslint": "eslint src/*",
|
||||||
|
"check:prettier": "prettier --check .",
|
||||||
|
"fix:prettier": "prettier --write .",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Ajay Bura",
|
"author": "Ajay Bura",
|
||||||
|
@ -19,7 +24,6 @@
|
||||||
"@khanacademy/simple-markdown": "0.8.6",
|
"@khanacademy/simple-markdown": "0.8.6",
|
||||||
"@matrix-org/olm": "3.2.14",
|
"@matrix-org/olm": "3.2.14",
|
||||||
"@tippyjs/react": "4.2.6",
|
"@tippyjs/react": "4.2.6",
|
||||||
"babel-polyfill": "6.26.0",
|
|
||||||
"blurhash": "2.0.4",
|
"blurhash": "2.0.4",
|
||||||
"browser-encrypt-attachment": "0.3.0",
|
"browser-encrypt-attachment": "0.3.0",
|
||||||
"dateformat": "5.0.3",
|
"dateformat": "5.0.3",
|
||||||
|
@ -46,37 +50,23 @@
|
||||||
"twemoji": "14.0.2"
|
"twemoji": "14.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.20.5",
|
"@rollup/plugin-wasm": "6.1.1",
|
||||||
"@babel/preset-env": "7.20.2",
|
"@types/react": "18.0.26",
|
||||||
"@babel/preset-react": "7.18.6",
|
"@types/react-dom": "18.0.9",
|
||||||
"assert": "2.0.0",
|
"@typescript-eslint/eslint-plugin": "5.46.1",
|
||||||
"babel-loader": "8.3.0",
|
"@typescript-eslint/parser": "5.46.1",
|
||||||
"browserify-fs": "1.0.0",
|
"@vitejs/plugin-react": "3.0.0",
|
||||||
"buffer": "6.0.3",
|
|
||||||
"clean-webpack-plugin": "4.0.0",
|
|
||||||
"copy-webpack-plugin": "11.0.0",
|
|
||||||
"crypto-browserify": "3.12.0",
|
|
||||||
"css-loader": "6.7.2",
|
|
||||||
"css-minimizer-webpack-plugin": "4.2.2",
|
|
||||||
"eslint": "8.29.0",
|
"eslint": "8.29.0",
|
||||||
"eslint-config-airbnb": "19.0.4",
|
"eslint-config-airbnb": "19.0.4",
|
||||||
|
"eslint-config-prettier": "8.5.0",
|
||||||
"eslint-plugin-import": "2.26.0",
|
"eslint-plugin-import": "2.26.0",
|
||||||
"eslint-plugin-jsx-a11y": "6.6.1",
|
"eslint-plugin-jsx-a11y": "6.6.1",
|
||||||
"eslint-plugin-react": "7.31.11",
|
"eslint-plugin-react": "7.31.11",
|
||||||
"eslint-plugin-react-hooks": "4.6.0",
|
"eslint-plugin-react-hooks": "4.6.0",
|
||||||
"html-loader": "4.2.0",
|
"prettier": "2.8.1",
|
||||||
"html-webpack-plugin": "5.5.0",
|
|
||||||
"mini-css-extract-plugin": "2.7.2",
|
|
||||||
"path-browserify": "1.0.1",
|
|
||||||
"sass": "1.56.2",
|
"sass": "1.56.2",
|
||||||
"sass-loader": "13.2.0",
|
"typescript": "4.9.4",
|
||||||
"stream-browserify": "3.0.0",
|
"vite": "4.0.1",
|
||||||
"style-loader": "3.3.1",
|
"vite-plugin-static-copy": "0.13.0"
|
||||||
"url": "0.11.0",
|
|
||||||
"util": "0.12.5",
|
|
||||||
"webpack": "5.75.0",
|
|
||||||
"webpack-cli": "5.0.1",
|
|
||||||
"webpack-dev-server": "4.11.1",
|
|
||||||
"webpack-merge": "5.8.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Cinny</title>
|
|
||||||
<meta name="name" content="Cinny">
|
|
||||||
<meta name="author" content="Ajay Bura">
|
|
||||||
<meta name="description" content="A Matrix client where you can enjoy the conversation using simple, elegant and secure interface protected by e2ee with the power of open source.">
|
|
||||||
<meta name="keywords" content="cinny, cinnyapp, cinnychat, matrix, matrix client, matrix.org, element">
|
|
||||||
|
|
||||||
<meta property="og:title" content="Cinny">
|
|
||||||
<meta property="og:url" content="https://cinny.in">
|
|
||||||
<meta property="og:image" content="https://cinny.in/assets/favicon-48x48.png">
|
|
||||||
<meta property="og:description" content="A Matrix client where you can enjoy the conversation using simple, elegant and secure interface protected by e2ee with the power of open source.">
|
|
||||||
<meta name="theme-color" content="#000000">
|
|
||||||
|
|
||||||
|
|
||||||
<link id="favicon" rel="shortcut icon" href="./favicon.ico" />
|
|
||||||
|
|
||||||
<link rel="manifest" href="./manifest.json" />
|
|
||||||
<meta name="mobile-web-app-capable" content="yes" />
|
|
||||||
<meta name="application-name" content="Cinny" />
|
|
||||||
<meta name="apple-mobile-web-app-title" content="Cinny" />
|
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
||||||
|
|
||||||
<link rel="apple-touch-icon" sizes="57x57" href="./res/apple/apple-touch-icon-57x57.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="60x60" href="./res/apple/apple-touch-icon-60x60.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="72x72" href="./res/apple/apple-touch-icon-72x72.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="76x76" href="./res/apple/apple-touch-icon-76x76.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="114x114" href="./res/apple/apple-touch-icon-114x114.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="120x120" href="./res/apple/apple-touch-icon-120x120.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="144x144" href="./res/apple/apple-touch-icon-144x144.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="152x152" href="./res/apple/apple-touch-icon-152x152.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="167x167" href="./res/apple/apple-touch-icon-167x167.png"/>
|
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="./res/apple/apple-touch-icon-180x180.png"/>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body id="appBody">
|
|
||||||
<div id="root"></div>
|
|
||||||
<audio id="notificationSound">
|
|
||||||
<source src="./sound/notification.ogg" type="audio/ogg" />
|
|
||||||
</audio>
|
|
||||||
<audio id="inviteSound">
|
|
||||||
<source src="./sound/invite.ogg" type="audio/ogg" />
|
|
||||||
</audio>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -11,49 +11,49 @@
|
||||||
"theme_color": "#fff",
|
"theme_color": "#fff",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "android-chrome-36x36.png",
|
"src": "/public/android/android-chrome-36x36.png",
|
||||||
"sizes": "36x36",
|
"sizes": "36x36",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-48x48.png",
|
"src": "/public/android/android-chrome-48x48.png",
|
||||||
"sizes": "48x48",
|
"sizes": "48x48",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-72x72.png",
|
"src": "/public/android/android-chrome-72x72.png",
|
||||||
"sizes": "72x72",
|
"sizes": "72x72",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-96x96.png",
|
"src": "/public/android/android-chrome-96x96.png",
|
||||||
"sizes": "96x96",
|
"sizes": "96x96",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-144x144.png",
|
"src": "/public/android/android-chrome-144x144.png",
|
||||||
"sizes": "144x144",
|
"sizes": "144x144",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-192x192.png",
|
"src": "/public/android/android-chrome-192x192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-256x256.png",
|
"src": "/public/android/android-chrome-256x256.png",
|
||||||
"sizes": "256x256",
|
"sizes": "256x256",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-384x384.png",
|
"src": "/public/android/android-chrome-384x384.png",
|
||||||
"sizes": "384x384",
|
"sizes": "384x384",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-512x512.png",
|
"src": "/public/android/android-chrome-512x512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
import * as sdk from 'matrix-js-sdk';
|
import * as sdk from 'matrix-js-sdk';
|
||||||
|
import Olm from '@matrix-org/olm';
|
||||||
// import { logger } from 'matrix-js-sdk/lib/logger';
|
// import { logger } from 'matrix-js-sdk/lib/logger';
|
||||||
|
|
||||||
import { secret } from './state/auth';
|
import { secret } from './state/auth';
|
||||||
|
@ -10,7 +11,7 @@ import Notifications from './state/Notifications';
|
||||||
import { cryptoCallbacks } from './state/secretStorageKeys';
|
import { cryptoCallbacks } from './state/secretStorageKeys';
|
||||||
import navigation from './state/navigation';
|
import navigation from './state/navigation';
|
||||||
|
|
||||||
global.Olm = require('@matrix-org/olm');
|
global.Olm = Olm;
|
||||||
|
|
||||||
// logger.disableAll();
|
// logger.disableAll();
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ class InitMatrix extends EventEmitter {
|
||||||
this.emit('init_loading_finished');
|
this.emit('init_loading_finished');
|
||||||
this.notifications._initNoti();
|
this.notifications._initNoti();
|
||||||
} else {
|
} else {
|
||||||
this.notifications._initNoti();
|
this.notifications?._initNoti();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RECONNECTING: () => {
|
RECONNECTING: () => {
|
||||||
|
|
|
@ -9,7 +9,4 @@ import App from './app/pages/App';
|
||||||
|
|
||||||
settings.applyTheme();
|
settings.applyTheme();
|
||||||
|
|
||||||
ReactDom.render(
|
ReactDom.render(<App />, document.getElementById('root'));
|
||||||
<App />,
|
|
||||||
document.getElementById('root'),
|
|
||||||
);
|
|
||||||
|
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"sourceMap": true,
|
||||||
|
"jsx": "react",
|
||||||
|
"target": "ES6",
|
||||||
|
"allowJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"outDir": "dist",
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules", "dist"],
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
44
vite.config.js
Normal file
44
vite.config.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import react from '@vitejs/plugin-react';
|
||||||
|
import { wasm } from '@rollup/plugin-wasm';
|
||||||
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||||
|
|
||||||
|
const copyFiles = {
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
src: 'node_modules/@matrix-org/olm/olm.wasm',
|
||||||
|
dest: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '_redirects',
|
||||||
|
dest: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: 'config.json',
|
||||||
|
dest: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: 'public/res/android',
|
||||||
|
dest: 'public/',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
appType: 'spa',
|
||||||
|
publicDir: false,
|
||||||
|
server: {
|
||||||
|
port: 8080,
|
||||||
|
host: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
viteStaticCopy(copyFiles),
|
||||||
|
wasm(),
|
||||||
|
react(),
|
||||||
|
],
|
||||||
|
build: {
|
||||||
|
outDir: 'dist',
|
||||||
|
sourcemap: true,
|
||||||
|
copyPublicDir: false,
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,66 +0,0 @@
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
||||||
const CopyPlugin = require("copy-webpack-plugin");
|
|
||||||
const webpack = require('webpack');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: {
|
|
||||||
polyfill: 'babel-polyfill',
|
|
||||||
main: './src/index.jsx'
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.js', '.jsx'],
|
|
||||||
fallback: {
|
|
||||||
'crypto': require.resolve('crypto-browserify'),
|
|
||||||
'path': require.resolve('path-browserify'),
|
|
||||||
'fs': require.resolve('browserify-fs'),
|
|
||||||
'stream': require.resolve('stream-browserify'),
|
|
||||||
'util': require.resolve('util/'),
|
|
||||||
'assert': require.resolve('assert/'),
|
|
||||||
'url': require.resolve('url/'),
|
|
||||||
'buffer': require.resolve('buffer'),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
global: true,
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.jsx?$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: {
|
|
||||||
loader: 'babel-loader',
|
|
||||||
options: {
|
|
||||||
presets: ['@babel/preset-env', '@babel/preset-react'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
use: ['html-loader'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|jpe?g|gif|otf|ttf|woff|woff2|ogg)$/,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.svg$/,
|
|
||||||
type: 'asset/inline',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new HtmlWebpackPlugin({ template: './public/index.html' }),
|
|
||||||
new CopyPlugin({
|
|
||||||
patterns: [
|
|
||||||
{ from: 'node_modules/@matrix-org/olm/olm.wasm' },
|
|
||||||
{ from: '_redirects' },
|
|
||||||
{ from: 'config.json' },
|
|
||||||
{ from: 'public/res/android'}
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
new webpack.ProvidePlugin({
|
|
||||||
Buffer: ['buffer', 'Buffer'],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
|
@ -1,27 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const common = require('./webpack.common');
|
|
||||||
const { merge } = require('webpack-merge');
|
|
||||||
|
|
||||||
module.exports = merge(common, {
|
|
||||||
mode: 'development',
|
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, 'dist'),
|
|
||||||
filename: '[name].bundle.js',
|
|
||||||
publicPath: '/',
|
|
||||||
},
|
|
||||||
devServer: {
|
|
||||||
historyApiFallback: true,
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.s?css$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
'css-loader',
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,39 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const common = require('./webpack.common');
|
|
||||||
const { merge } = require('webpack-merge');
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
||||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = merge(common, {
|
|
||||||
mode: 'production',
|
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, 'dist'),
|
|
||||||
filename: '[name].[contenthash].bundle.js',
|
|
||||||
},
|
|
||||||
optimization: {
|
|
||||||
minimize: true,
|
|
||||||
minimizer: [
|
|
||||||
'...',
|
|
||||||
new CssMinimizerPlugin(),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.s?css$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
'css-loader',
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new CleanWebpackPlugin(),
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: '[name].[contenthash].bundle.css',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
Loading…
Reference in a new issue