Added react, snowpack and typescript to project template

This commit is contained in:
Dmitriy Shishkov 2021-04-28 22:43:35 +05:00
commit c1f8acef8c
No known key found for this signature in database
GPG Key ID: 7CAE12ED13853CAC
7 changed files with 87 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules/
package-lock.json
build/

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"scripts": {
"dev": "snowpack dev",
"build": "snowpack build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@snowpack/plugin-typescript": "^1.2.1",
"@types/node": "^15.0.1",
"@types/react": "^17.0.4",
"@types/react-dom": "^17.0.3",
"@types/snowpack-env": "^2.3.3",
"snowpack": "^3.3.5",
"typescript": "^4.2.4"
},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
}

15
public/index.html Normal file
View File

@ -0,0 +1,15 @@
<!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>

21
snowpack.config.js Normal file
View File

@ -0,0 +1,21 @@
// 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,
},
devOptions: {
open: "none",
},
exclude: ["**/node_modules/**/*", "**/*.test.*"],
};

1
src/App.tsx Normal file
View File

@ -0,0 +1 @@
export const App = () => <div>Hello, world</div>;

15
src/index.tsx Normal file
View File

@ -0,0 +1,15 @@
import React from "react";
import ReactDOM from "react-dom";
import { App } from "./App";
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
if (import.meta.hot) {
import.meta.hot.accept();
}

12
tsconfig.json Normal file
View File

@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es5",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",
"lib": ["DOM"],
"module": "ES2020"
}
}