본문 바로가기

Front-end

VanilaJS로 라우팅 구현 시 주의할 것

1. publicPath 명시

const path = require('path');

module.exports = {
  //...
  output: {
    //...
    publicPath: '/',
  },
};

2. historyApiFallback 설정

 -> 404 발생 시 index.html로 fallback

module.exports = {
  //...
  devServer: {
    historyApiFallback: true,
  },
};

 

'Front-end' 카테고리의 다른 글

TypeScript 사용 시 'exports is not defined' error  (0) 2021.06.28