Skip to content

Instantly share code, notes, and snippets.

@maladr0it
Last active October 30, 2019 07:10
Show Gist options
  • Select an option

  • Save maladr0it/2f083838119a4a24b0ea504f5d612895 to your computer and use it in GitHub Desktop.

Select an option

Save maladr0it/2f083838119a4a24b0ea504f5d612895 to your computer and use it in GitHub Desktop.
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript",
"@babel/preset-react"
]
}
import React from "react";
import ReactDOM from "react-dom";
import "core-js/stable";
import "regenerator-runtime";
const getThing = async () => {
await fetch("https://www.google.com");
}
const App = () => {
return (
<button
onClick={() => getThing()
>
FETCH
</button>
);
};
ReactDOM.render(<App />, document.getElementById("root"));
{
"name": "client",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development --host 0.0.0.0 --hot",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@svgr/webpack": "^4.3.3",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.3",
"@types/react-router-dom": "^5.1.0",
"@types/styled-components": "^4.1.20",
"babel-loader": "^8.0.6",
"core-js": "^3.3.5",
"css-loader": "^3.2.0",
"html-webpack-plugin": "^3.2.0",
"regenerator-runtime": "^0.13.3",
"style-loader": "^1.0.0",
"typescript": "^3.6.4",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.9.0"
},
"dependencies": {
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-router-dom": "^5.1.2",
}
}
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"jsx": "react"
}
}
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./src/index",
output: {
path: path.join(__dirname, "/dist"),
filename: "bundle.js",
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.svg$/,
use: ["@svgr/webpack"],
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
],
},
devServer: {
historyApiFallback: true,
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/index.html",
minify: {
collapseWhitespace: true,
},
}),
],
};
@mpalmr
Copy link

mpalmr commented Oct 30, 2019

{
  "presets": [
    ["@babel/preset-env", { "modules": false }],
    "@babel/preset-typescript",
    "@babel/preset-react"
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment