Switched from snowpack to vite

This commit is contained in:
Dmitriy Shishkov 2021-10-11 13:52:38 +03:00
parent c3ae023ff7
commit 60724dfa60
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
7 changed files with 32 additions and 54 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules/ node_modules/
package-lock.json package-lock.json
build/ pnpm-lock.yaml
dist/

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React application</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="./src/index.tsx"></script>
</body>
</html>

View File

@ -1,20 +1,21 @@
{ {
"scripts": { "scripts": {
"dev": "snowpack dev", "dev": "vite",
"build": "snowpack build", "build": "vite build",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"devDependencies": { "devDependencies": {
"@snowpack/plugin-typescript": "^1.2.1", "serve": "^12.0.0",
"@types/node": "^15.0.1", "typescript": "^4.4.2",
"@types/react": "^17.0.4", "vite": "^2.5.3",
"@types/react-dom": "^17.0.3", "@emotion/react": "^11.4.1",
"@types/snowpack-env": "^2.3.3", "@emotion/styled": "^11.3.0"
"snowpack": "^3.3.5",
"typescript": "^4.2.4"
}, },
"dependencies": { "dependencies": {
"@mui/icons-material": "^5.0.3",
"@mui/material": "^5.0.3",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2" "react-dom": "^17.0.2"
} },
"private": "true"
} }

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React application</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/dist/index.js"></script>
</body>
</html>

View File

@ -1,25 +0,0 @@
// Snowpack Configuration File
// See all supported options: https://www.snowpack.dev/reference/configuration
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
plugins: ["@snowpack/plugin-typescript"],
packageOptions: {
polyfillNode: true,
},
mount: {
public: "/",
src: "/dist",
},
optimize: {
bundle: true,
},
routes: [
{ match: "routes", src: "robots.txt", dest: "/robots.txt" },
{ match: "routes", src: ".*", dest: "/index.html" },
],
devOptions: {
open: "none",
},
exclude: ["**/node_modules/**/*", "**/*.test.*"],
};

View File

@ -1,13 +1,13 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "ESNext",
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"jsx": "react-jsx", "jsx": "react-jsx",
"lib": ["DOM"], "lib": ["es6", "DOM", "dom.iterable"],
"module": "ES2020", "module": "ESNext",
"moduleResolution": "node" "moduleResolution": "node"
} }
} }

3
vite.config.js Normal file
View File

@ -0,0 +1,3 @@
import { defineConfig } from "vite";
export default defineConfig({});