Clone Coding/Instagram

[Instagram] 프로젝트 설정(5) - favicon 적용

고코모옹 2021. 7. 12. 21:52

[ favicon ]

  • 인터넷 웹 브라우저의 주소창에 표시되는 웹사이트나 웹페이지를 대표하는 아이콘

 

- favicon 아이콘 변환

 

 

- 프로젝트에 favicon 적용

  • 변환한 favicon.ico 파일 프로젝트에 추가
  • webpack.config.js plugin 속성에 favicon 설정
// webpack.config.js
const path = require('path');
const HtmlPlugin = require('html-webpack-plugin');

module.exports = {
  entry: './src/js/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'index.js',
    clean: true, // 재빌드 시, 필요없는 파일들 제거
  },
  module: {
    rules: [
      {
        test: /\.s?css$/,
        use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'],
      },
      {
        test: /\.js$/,
        use: ['babel-loader'],
      },
    ],
  },
  resolve: {
    extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
    alias: {
      '~': path.resolve(__dirname, 'src'),
    },
  },
  plugins: [
    new HtmlPlugin({
      template: './src/html/index.html',
      favicon: './favicon.ico',
    }),
  ],
};