Browse Source

webpack

pull/206/head
xoron 2 years ago
committed by GitHub
parent
commit
1ca7388bfd
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12072
      package-lock.json
  2. 14
      package.json
  3. 4
      src/App.tsx
  4. 2
      src/components/PageComponents/Messages/Message.tsx
  5. 4
      src/index.tsx
  6. 4
      src/validation/config/position.ts
  7. 14
      tsconfig.json
  8. 91
      webpack.config.js

12072
package-lock.json

File diff suppressed because it is too large

14
package.json

@ -1,12 +1,12 @@
{ {
"name": "meshtastic-web", "name": "meshtastic-web",
"version": "2.3.3-0", "version": "2.3.3-0",
"type": "module",
"description": "Meshtastic web client", "description": "Meshtastic web client",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"scripts": { "scripts": {
"dev": "vite --host", "dev": "vite --host",
"build": "tsc && vite build", "build": "tsc && vite build",
"build:webpack": "webpack build --config webpack.config.js",
"check": "biome check .", "check": "biome check .",
"preview": "vite preview", "preview": "vite preview",
"package": "gzipper c -i html,js,css,png,ico,svg,webmanifest,txt dist dist/output && tar -cvf dist/build.tar -C ./dist/output/ $(ls ./dist/output/)" "package": "gzipper c -i html,js,css,png,ico,svg,webmanifest,txt dist dist/output && tar -cvf dist/build.tar -C ./dist/output/ $(ls ./dist/output/)"
@ -60,6 +60,8 @@
"zustand": "4.5.2" "zustand": "4.5.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@biomejs/biome": "^1.6.3", "@biomejs/biome": "^1.6.3",
"@buf/meshtastic_protobufs.bufbuild_es": "1.8.0-20240325205556-b11811405eea.2", "@buf/meshtastic_protobufs.bufbuild_es": "1.8.0-20240325205556-b11811405eea.2",
"@types/chrome": "^0.0.263", "@types/chrome": "^0.0.263",
@ -70,14 +72,20 @@
"@types/web-bluetooth": "^0.0.20", "@types/web-bluetooth": "^0.0.20",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"babel-loader": "^9.1.3",
"gzipper": "^7.2.0", "gzipper": "^7.2.0",
"html-webpack-plugin": "^5.6.0",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"rollup-plugin-visualizer": "^5.12.0", "rollup-plugin-visualizer": "^5.12.0",
"tailwindcss": "^3.4.3", "tailwindcss": "^3.4.3",
"tar": "^6.2.1", "tar": "^6.2.1",
"ts-loader": "^9.5.1",
"tslib": "^2.6.2", "tslib": "^2.6.2",
"typescript": "^5.4.3", "typescript": "^5.4.5",
"vite": "^5.2.6", "vite": "^5.2.6",
"vite-plugin-environment": "^1.1.3" "vite-plugin-environment": "^1.1.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
} }
} }

4
src/App.tsx

@ -1,4 +1,4 @@
import { DeviceWrapper } from "@app/DeviceWrapper.js"; import { DeviceWrapper } from "@app/DeviceWrapper.js"
import { PageRouter } from "@app/PageRouter.js"; import { PageRouter } from "@app/PageRouter.js";
import { CommandPalette } from "@components/CommandPalette.js"; import { CommandPalette } from "@components/CommandPalette.js";
import { DeviceSelector } from "@components/DeviceSelector.js"; import { DeviceSelector } from "@components/DeviceSelector.js";
@ -50,3 +50,5 @@ export const App = (): JSX.Element => {
</ThemeController> </ThemeController>
); );
}; };
export default App;

2
src/components/PageComponents/Messages/Message.tsx

@ -67,7 +67,7 @@ export const Message = ({
message.state === "ack" ? "text-textPrimary" : "text-textSecondary" message.state === "ack" ? "text-textPrimary" : "text-textSecondary"
}`} }`}
> >
{message.data} {message.data}asdasdkjahkd!!!!!!!123!!!!!!!!
</span> </span>
</div> </div>
</div> </div>

4
src/index.tsx

@ -16,3 +16,7 @@ root.render(
<App /> <App />
</StrictMode>, </StrictMode>,
); );
export default () => (
<App />
);

4
src/validation/config/position.ts

@ -40,4 +40,8 @@ export class PositionValidation
@IsArray() @IsArray()
channelPrecision: number[]; channelPrecision: number[];
gpsEnabled: boolean;
gpsAttemptTime: number;
} }

14
tsconfig.json

@ -1,20 +1,17 @@
{ {
"include": ["src"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"], "lib": ["DOM", "DOM.Iterable", "ESNext", "es5", "es6"],
"allowJs": false,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"strict": true, "strict": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node", "moduleResolution": "Node",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": false,
"jsx": "react-jsx", "jsx": "react-jsx",
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
@ -34,6 +31,11 @@
"@types/w3c-web-serial" "@types/w3c-web-serial"
], ],
"strictPropertyInitialization": false, "strictPropertyInitialization": false,
"experimentalDecorators": true "experimentalDecorators": true,
"outDir": "./dist/",
"noImplicitAny": false,
"module": "es6",
"target": "es5",
"allowJs": true,
} }
} }

91
webpack.config.js

@ -0,0 +1,91 @@
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { ModuleFederationPlugin } = require('webpack').container;
// const WebpackPwaManifest = require('webpack-pwa-manifest');
const path = require('path');
module.exports = {
mode: 'development',
entry: './src/App.tsx',
output: {
filename: 'main.js',
path: __dirname + '/dist',
publicPath: 'auto',
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.jsx'],
alias: {
"@app": path.resolve("./src"),
"@pages": path.resolve(__dirname, "./src/pages"),
"@components": path.resolve(__dirname, "./src/components"),
"@core": path.resolve(__dirname, "./src/core"),
"@layouts": path.resolve(__dirname, "./src/layouts"),
},
},
module: {
rules: [
{
test: /\.(ts|tsx|js|jsx)$/,
use: ["babel-loader", "ts-loader"],
exclude: /node_modules/,
// options: {
// presets: ["@babel/preset-react"],
// },
},
// {
// test: /\.(ts|tsx|js|jsx)$/,
// use: 'ts-loader',
// exclude: /node_modules/,
// },
// css and scss loader
{
// test: /\.css$/,
test: /\.(css|scss)$/,
use: ["style-loader", "css-loader"],
},
// image loader
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
}),
// new WebpackPwaManifest({
// filename: "manifest.json",
// name: 'positive-intentions',
// short_name: 'PI',
// description: 'positive-intentions',
// "icons": [
// {
// src: path.resolve('./public/favicon.ico'),
// sizes: [96] // multiple sizes
// },
// {
// src: path.resolve('./public/logo512.png'),
// sizes: [96, 128, 192, 256, 384, 512], // multiple sizes
// maskable: true,
// }
// ],
// "start_url": ".",
// "display": "standalone",
// "theme_color": "#44b700",
// "background_color": "#ffffff",
// // crossorigin: 'use-credentials', // can be null, use-credentials or anonymous
// inject: true,
// }),
new ModuleFederationPlugin({
name: 'meshtastic',
filename: 'remoteEntry.js',
exposes: {
'./meshtastic': './src/App.tsx',
},
shared: { react: { singleton: true }, "react-dom": { singleton: true } }
}),
],
};
Loading…
Cancel
Save