Skip to content

Instantly share code, notes, and snippets.

View velotiotech's full-sized avatar

Velotio Technologies velotiotech

View GitHub Profile
export const BLE_NAME = "SAMPlE_BLE"
export const BLE_SERVICE_ID = "5476534d-1213-1212-1212-454e544f1212"
export const BLE_READ_CHAR_ID = "00105354-0000-1000-8000-00805f9b34fb"
export const BLE_WRITE_CHAR_ID = "00105352-0000-1000-8000-00805f9b34fb"
export const BleContextProvider = ({
children,
}: {
children: React.ReactNode
}) => {
// webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
npm start
"scripts": {
"start": "webpack serve --mode development --open",
"build": "webpack --mode production"
}
// webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
// .babelrc
{
"presets": ["@babel/preset-react", "@babel/preset-env"]
}
npm install --save-dev webpack webpack-cli webpack-dev-server # webpack
npm install --save-dev @babel/core @babel/preset-react @babel/preset-env babel-loader #babel
npm install --save-dev html-webpack-plugin
npm install --save-dev webpack webpack-cli webpack-dev-server @babel/core @babel/preset-react @babel/preset-env babel-loader html-webpack-plugin
<!-- public/index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>React with Webpack</title>
</head>
<body>
<div id="root"></div> <!-- Do not miss this one -->
</body>
// src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
const App = () => {
return <h1>Hello, React with Webpack!</h1>;
};
ReactDOM.render(<App />, document.getElementById('root'));