Skip to content

Commit

Permalink
[#43] refactor: 바벨 설정을 웹팩 설정에 합침, package.json 정보 일부 수정, 불필요 패키지 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
deprecated-hongbiii committed Oct 28, 2021
1 parent 89b0c04 commit b28da58
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 88 deletions.
15 changes: 0 additions & 15 deletions .babelrc

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
package-lock.json
.env
.env
/dist
2 changes: 0 additions & 2 deletions dist/bundle.js

This file was deleted.

59 changes: 0 additions & 59 deletions dist/bundle.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.html

This file was deleted.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "miracle-coding-blog",
"version": "1.0.0",
"description": "MiracleCoding study 의 TIL 을 모아서 볼수 있는 홈페이지를 만드는 프로젝트입니다.",
"version": "0.0.3",
"description": "미라클코딩 멤버들의 아티클을 모아서 볼 수 있는 웹사이트",
"main": "index.js",
"scripts": {
"start": "webpack serve --open --config webpack.dev.js",
"build": "webpack --config webpack.prod.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eamon3481/MiracleCodingBlog.git"
"url": "git+https://github.com/mico-members/miracle-coding-blog.git"
},
"keywords": [],
"author": "",
"author": "Autumn",
"license": "ISC",
"bugs": {
"url": "https://github.com/eamon3481/MiracleCodingBlog/issues"
"url": "https://github.com/mico-members/miracle-coding-blog/issues"
},
"homepage": "https://github.com/eamon3481/MiracleCodingBlog#readme",
"homepage": "https://github.com/mico-members/miracle-coding-blog#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"axios": "^0.21.1",
Expand All @@ -31,7 +31,6 @@
"devDependencies": {
"@babel/cli": "^7.14.5",
"@babel/core": "^7.14.6",
"@babel/plugin-transform-runtime": "^7.14.5",
"@babel/preset-env": "^7.14.7",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.14.5",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"outDir": "./dist",
"target": "es5",
"target": "es6",
"module": "esnext",
"jsx": "react-jsx",
"noImplicitAny": true,
Expand All @@ -16,5 +16,5 @@
"resolveJsonModule": true,
"isolatedModules": true
},
"include": ["src"]
"include": ["src"]
}
16 changes: 15 additions & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,21 @@ module.exports = {
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: { chrome: '58' } }],
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
'@babel/preset-typescript',
],
},
},
},
{
test: /\.svg$/,
Expand Down
1 change: 1 addition & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ module.exports = merge(common, {
port: process.env.PORT || 8080,
open: true,
historyApiFallback: true,
hot: true,
},
});

1 comment on commit b28da58

@deprecated-hongbiii
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정 사항과 이유

  • 별도의 파일로 존재하던 바벨 설정을 웹팩 설정에 합침
    • 웹팩 설정에서도 바벨의 상세 설정을 할 수 있기 때문!
    • @babel/preset-env에 별도의 타겟 설정이 안 되어 있었는데 그런 경우에는 모든 ES2015-ES2020 코드를 ES5로 바꾸기 때문에 targets 설정 추가
    • 참고: https://babeljs.io/docs/en/babel-preset-env#no-targets
  • 웹팩 dev 모드에 HMR 설정을 true로 바꿈
  • @babel/plugin-transform-runtime 삭제
    • 해당 패키지는 regenerator-runtime과 core-js를 포함하는 폴리필 패키지임
    • @babel/preset-env에서 이미 폴리필을 사용할 수 있기 때문에 삭제
    • 참고: https://www.npmjs.com/package/babel-loader 중간 쯤 NOTE: transform-runtime & custom polyfills (e.g. Promise library) 라고 적혀있는 부분

Please sign in to comment.