인프런 커뮤니티 질문&답변
devServer 설정 에러가 납니다.
작성
·
2K
0
위와 같이 설정 시에 아래처럼 index라는 옵션이 없다고 뜨는데 왜그러는걸까요...?
강의영상 시간 : 3:06
----------------------------------------
ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options has an unknown property 'index'. These properties are valid:
object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }
답변 4
1
안녕하세요. 독자님.
webpack-dev-server 버전 4.x 에서는 옵션이 바뀌었군요.
아래처럼 해 보세요.
  devServer: {
    static: {
      staticOptions: {
        index: 'home.html',
      },
    },
 }감사합니다.
0
0
0
독자님.
한줄 더 추가해야 정확하겠군요. (Webpack v5 / webpack-dev-server v4 이상에서)
const path = require('path');
  
  devServer: {
    static: {
      directory: path.join(__dirname, 'dist'),
      staticOptions: {
        index: 'home.html',
      },
    },
  },




