From d3f3205a0222a27000caa0f7e45cb672083c4355 Mon Sep 17 00:00:00 2001 From: Belem Zhang Date: Fri, 24 May 2024 12:53:43 +0800 Subject: [PATCH] Add basic-ssl plugin in vite to remove openssl new key generation (#241) --- README.md | 3 +-- package.json | 5 +++-- vite.config.js | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 vite.config.js diff --git a/README.md b/README.md index 9fb13259..a684a126 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,8 @@ To get started, follow these steps: ```bash > git clone --recurse-submodules https://github.com/webmachinelearning/webnn-samples > cd webnn-samples -> openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem > npm install -> npm start +> npm run start ``` 2. Navigate to the desired sample directory that you want to explore. 3. Read the accompanying README.md file for the sample to understand its purpose, requirements, and implementation details. diff --git a/package.json b/package.json index 3a5ead7b..41d8d37a 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,12 @@ "@babel/plugin-syntax-top-level-await": "^7.12.1", "eslint": "^7.5.0", "eslint-config-google": "^0.14.0", - "http-server": "^0.12.3" + "@vitejs/plugin-basic-ssl": "^1.1.0", + "vite": "^5.1.7" }, "scripts": { "lint": "eslint . --ext .js", - "start": "http-server -S cert.pem -o" + "start": "vite --host" }, "dependencies": { "babel-eslint": "^8.0.3" diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 00000000..e4e1185d --- /dev/null +++ b/vite.config.js @@ -0,0 +1,9 @@ +import {defineConfig} from 'vite'; +import basicSsl from '@vitejs/plugin-basic-ssl'; + +export default defineConfig({ + build: { + target: 'esnext', + }, + plugins: [basicSsl()], +});