Skip to content
This repository was archived by the owner on Dec 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Setup React and JSX (WIP)
  • Loading branch information
cafca authored and sophiiistika committed Oct 12, 2020
commit f00913d5a8fae7d0caf584ed50d92dfc2ad1d70e
120 changes: 71 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

const App = () => <p>Hallo</p>;

export default App;
8 changes: 8 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'core-js/stable';
import 'regenerator-runtime/runtime';

import React from 'react';
import ReactDOM from 'react-dom';
import App from './app'

ReactDOM.render(<App />, document.getElementById('root'));
27 changes: 15 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
const path = require('path');
const path = require("path");

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPlugin = require("html-webpack-plugin");

const getPath = (file) => {
return path.resolve(__dirname, 'src', file);
return path.resolve(__dirname, "src", file);
};

module.exports = () => {
return {
target: 'web',
devtool: 'eval-source-map',
entry: getPath('index.jsx'),
target: "web",
devtool: "eval-source-map",
entry: getPath("index.tsx"),
resolve: {
extensions: ['.js', '.jsx'],
extensions: [".ts", ".tsx"],
},
module: {
rules: [
{
test: /\.jsx?/,
test: /\.tsx?/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
loader: "babel-loader",
},
{
loader: 'eslint-loader',
loader: "eslint-loader",
},
{
loader: "ts-loader",
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: getPath('index.html'),
filename: "index.html",
template: getPath("index.html"),
}),
],
devServer: {
Expand Down