Skip to content

Commit

Permalink
Merge pull request #6 from kimyouknow/develop-FE
Browse files Browse the repository at this point in the history
[Build] 개발환경 세팅
  • Loading branch information
HongJungKim-dev committed May 25, 2022
2 parents 6ba19ea + 9c31241 commit 058fa1e
Show file tree
Hide file tree
Showing 15 changed files with 17,487 additions and 0 deletions.
60 changes: 60 additions & 0 deletions FE/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"airbnb-typescript",
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["react", "import", "@typescript-eslint"],
"rules": {
"prettier/prettier": ["error", {}, { "usePrettierrc": true }],
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"no-undef": "off",
"@typescript-eslint/no-var-require": "off",
"@typescript-eslint/no-var-requires": "off",
"import/no-unresolved": "off",
"no-use-before-define": ["error", { "functions": false }],
"react/react-in-jsx-scope": "off",
"import/order": [
"error",
{
"groups": ["builtin", "external", ["parent", "sibling"], "index"],
"pathGroups": [
{
"pattern": "@/**",
"group": "external",
"position": "after"
}
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always"
}
]
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {}
}
}
}
2 changes: 2 additions & 0 deletions FE/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/dist
9 changes: 9 additions & 0 deletions FE/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"useTabs": false,
"printWidth": 100,
"arrowParens": "avoid",
"trailingComma": "all"
}
Empty file added FE/README.md
Empty file.
10 changes: 10 additions & 0 deletions FE/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
["@babel/preset-react", { "runtime": "automatic" }],
[
"@babel/preset-env",
{ "targets": "> 0.25%, not dead", "modules": false, "useBuiltIns": "usage", "corejs": 3 }
],
"@babel/preset-typescript"
]
}
27 changes: 27 additions & 0 deletions FE/config/webpack.common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const path = require('path');

const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');

module.exports = {
resolve: {
alias: {
'@': path.resolve(__dirname, '../src'),
},
extensions: ['.js', '.jsx', '.ts', '.tsx', '.css'],
},
entry: `${path.resolve(__dirname, '../src')}/index.tsx`,
module: {
rules: [],
},
plugins: [
new HtmlWebpackPlugin({
template: `${path.resolve(__dirname, '../public')}/index.html`,
}),
new webpack.ProvidePlugin({ React: 'react' }),
new ReactRefreshWebpackPlugin(),
// new BundleAnalyzerPlugin(),
],
};
33 changes: 33 additions & 0 deletions FE/config/webpack.development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { merge } = require('webpack-merge');

const common = require('./webpack.common');

module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
open: false,
hot: true,
compress: true,
port: 3000,
historyApiFallback: true,
liveReload: true,
},
output: {
filename: '[name].[contenthash].js',
publicPath: '/',
},
module: {
rules: [
{
test: /\.(ts|tsx|js|jsx)$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.(sa|sc|c)ss$/i,
use: ['style-loader', 'css-loader', 'file-loader'],
},
],
},
});
47 changes: 47 additions & 0 deletions FE/config/webpack.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const path = require('path');

const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const { merge } = require('webpack-merge');

const common = require('./webpack.common');

module.exports = merge(common, {
mode: 'production',
devtool: 'cheap-module-source-map',
output: {
filename: '[name].[contenthash].js',
path: path.resolve(__dirname, '../dist'),
publicPath: '/',
clean: true,
},
module: {
rules: [
{
test: /\.(ts|tsx|js|jsx)$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.(sa|sc|c)ss$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
plugins: [new MiniCssExtractPlugin()],
optimization: {
usedExports: true,
minimize: true,
minimizer: [
new TerserPlugin({ terserOptions: { compress: { drop_console: true } } }),
new CssMinimizerPlugin(),
],
splitChunks: { chunks: 'all' },
},
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
});
Loading

0 comments on commit 058fa1e

Please sign in to comment.