Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 9 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
"presets": [
"@babel/env",
"@babel/react",
["@babel/typescript", {
"isTSX": true,
"allExtensions": true
}]
],
"plugins": ["@babel/proposal-class-properties", "@babel/proposal-object-rest-spread"]
}
10 changes: 9 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"rules": {
"prettier/prettier": ["error"],
"import/no-extraneous-dependencies": 0,
"react/jsx-filename-extension": 0
"react/jsx-filename-extension": 0,
"react/prop-types": 0
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
],
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const WebpackBundleAnalyzer = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const WebpackBundleAnalyzer = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;

module.exports = {
plugins: [
new WebpackBundleAnalyzer({
analyzerMode: 'static',
reportFilename: './report.html',
openAnalyzer: false
})
]
};
openAnalyzer: false,
}),
],
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const Visualizer = require('webpack-visualizer-plugin');

module.exports = {
plugins: [
new Visualizer()
]
};
plugins: [new Visualizer()],
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: './src/index.js',
entry: './src/index',
module: {
rules: [
{
test: /\.(js|jsx)$/,
test: /\.(ts|tsx|js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader'],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx'],
extensions: ['*', '.ts', '.tsx', '.js', '.jsx'],
},
plugins: [
new CleanWebpackPlugin(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const webpackMerge = require('webpack-merge');

const commonConfig = require('./webpack.common.js');
const commonConfig = require('./webpack.common.ts');

const getAddons = addonsArgs => {
const addons = Array.isArray(addonsArgs)
Expand All @@ -12,11 +12,11 @@ const getAddons = addonsArgs => {

return addons
.filter(Boolean)
.map(name => require(`./addons/webpack.${name}.js`));
.map(name => require(`./addons/webpack.${name}.ts`));
};

module.exports = ({ env, addon }) => {
const envConfig = require(`./webpack.${env}.js`);
const envConfig = require(`./webpack.${env}.ts`);

return webpackMerge(commonConfig, envConfig, ...getAddons(addon));
};
File renamed without changes.
File renamed without changes.
97 changes: 94 additions & 3 deletions package-lock.json

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

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --config build-utils/webpack.config.js --env.env=dev",
"build": "webpack --config build-utils/webpack.config.js --env.env=prod",
"start": "webpack-dev-server --config build-utils/webpack.config.ts --env.env=dev",
"build": "webpack --config build-utils/webpack.config.ts --env.env=prod",
"build:analyze": "npm run build -- --env.addon=bundleanalyze --env.addon=bundlevisualizer",
"test": "echo \"Error: no test specified\" && exit 0"
},
Expand All @@ -14,8 +14,14 @@
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@types/react": "^16.9.9",
"@types/react-dom": "^16.9.2",
"@types/webpack-env": "^1.14.1",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"clean-webpack-plugin": "^3.0.0",
Expand All @@ -39,7 +45,6 @@
"webpack-visualizer-plugin": "^0.1.11"
},
"dependencies": {
"prop-types": "^15.7.2",
"react": "^16.10.2",
"react-dom": "^16.10.2"
}
Expand Down
10 changes: 0 additions & 10 deletions src/App.js

This file was deleted.

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

interface AppProps {
title: string;
}

const App: React.FC<AppProps> = ({ title }) => <div>{title}</div>;

export default App;
File renamed without changes.