Skip to content

Instantly share code, notes, and snippets.

@baetheus
Last active November 21, 2018 21:49
Show Gist options
  • Select an option

  • Save baetheus/03b7ef1c9abcff9f05390904329ede8c to your computer and use it in GitHub Desktop.

Select an option

Save baetheus/03b7ef1c9abcff9f05390904329ede8c to your computer and use it in GitHub Desktop.
Parcel React Typescript Setup
npm i @nll/{css,rx-fsa} lodash react react-dom redux
npm i -D @nll/schematics-react @types/{lodash,node,react,react-dom,redux} parcel-bundler typescript
<html>
<head>
<title>Website</title>
<link rel="stylesheet" type="text/css" href="styles/main.css" />
</head>
<body>
<main id="app"></main>
</body>
<script src="index.tsx"></script>
</html>
import * as React from 'react';
import { render } from 'react-dom';
const App: React.SFC = () => <section>Hello World</section>;
const container = document.getElementById('app');
render(<App />, container);
@import './vendor/nll-css';
@import '../../../node_modules/@nll/css/dist/main';
{
"build": "parcel build src/index.html",
"clean": "rm -rf dist .cache",
"g:c": "schematics @nll/schematics-react:component",
"g:sc": "schematics @nll/schematics-react:stateless-component",
"start": "parcel src/index.html -p 4200",
"test": "echo \"Error: no test specified\" && exit 1"
}
{
"compilerOptions": {
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"allowUnreachableCode": false,
"noImplicitAny": true,
"noErrorTruncation": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"lib": ["es5", "es6", "dom"],
"types": ["node"],
"jsx": "react",
"baseUrl": "./src",
"paths": {
"$components/*": ["components/*"],
"$environments/*": ["environments/*"],
"$libraries/*": ["libraries/*"],
"$pages/*": ["pages/*"],
"$stores/*": ["stores/*"]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment