🖥Frontend/Nuxt.JS

DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.

코너(Corner) 2022. 7. 7.
반응형

DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.

오류 사진

image-20220707164739405

Nuxt.js에서 Generate를 사용하여 Product 환경에 배포하려고 할 때 발생되는 현상으로,

많은 사람들의 의견이 갈리는데 대체로 $nuxt에서 html 구조를 이상한 태그를 추가하여 발생하는 오류라고 합니다.

때문에 번들링에서 생기는 오류로써 이를 해결하기 위해서는

gulp 같은 방식을 사용해야 하는데 따로 설치를 하지 않고도 처리를 진행할 수 있는 방법이

nuxt에서는 가능합니다.

nuxt.config.js

module.exports = {
  build: {
    html: {
      minify: {
        collapseWhitespace: true,  // as @dario30186 mentioned
        removeComments: true, // 👈 add this line
      },
    },
  },
};
반응형

댓글