• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

next.config.js 설정 관련 질문입니다. 사진과 동영상

20.07.15 17:27 작성 조회수 289

0

넥스트는 9.4.4버전입니다.

next.config.js파일의 내용입니다.

const withImages = require('next-images')
const withVideos = require('next-videos')


module.exports =
withImages({
webpack(config, options) {
return config
}
}),
withVideos({
assetDirectory: 'static',
webpack(config, options) {
return config
}
})

동영상이 나오는 태그입니다.

<video autoPlay loop muted width="100%" height="100%" >
<source src={require("../public/forchange.mp4")} type="video/mp4" />
</video>

사진이 나오는 태그입니다.

<img alt="fortest" src={require('../public/back3.png')} style={{width:"500px", height:"200px", position:"absolute", right:"150px"}}/>

withImages

를 위로 올리면 사진만 출력이 되고

withVideos

를 위로 올리면 동영상만 출력이 됩니다.

사진과 동영상 둘다 출력하려면 어떻게 해야할까요?

답변 1

답변을 작성해보세요.

0

with 같은 애들은 수직적인 구조입니다. 하나 안에 다른 애들을 넣어야 합니다.

module.exports = withImages(withVideos({

  webpack...,

  다른 설정들...

}))

지금은 콤마로 두개를 연결하셨는데 이러면 콤마연산자(순서대로 실행 후 마지막 것 리턴)가 적용됩니다.