인프런 커뮤니티 질문&답변
뷰 폴더 복사하기 configureWebpack 에러
작성
·
339
1
뷰 폴더 복사하기 강의를 듣고 있습니다. configureWebpack 를 추가하는 부분에서 에러가 발생합니다.
  configureWebpack: {
    plugins: [
      new FileManagerPlugin({
        events: {
          onStart: {
            delete: [
              '../backend/static/**',
              '../backend/templates/**',
            ],
          },
          onEnd: {
            copy: [
              { source: './dist/static', destination: '../backend/static' },
              { source: './dist/favicon.ico', destination: '../backend/static/img/' },
              { source: './dist/home.html', destination: '../backend/templates/' },
              { source: './dist/dashboard.html', destination: '../backend/templates/dashboard/' },
            ],
          },
        },
      }),
    ],
  },위와 같이 따라서 코드를 입력했는데 다음의 에러가 발생합니다.
 ERROR  Error loading vue.config.js:
 ERROR  TypeError: defineConfig is not a function
TypeError: defineConfig is not a function
    at Object.<anonymous> (E:\Enterprise\DonkeyJim\frontend\vue.config.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Service.loadUserOptions (E:\Enterprise\DonkeyJim\frontend\node_modules\@vue\cli-service\lib\Service.js:283:22)    at Service.init (E:\Enterprise\DonkeyJim\frontend\node_modules\@vue\cli-service\lib\Service.js:72:30)
    at Service.run (E:\Enterprise\DonkeyJim\frontend\node_modules\@vue\cli-service\lib\Service.js:204:10)
어떤 부분이 문제인지 모르겠습니다.
답변 2
1
김석훈
지식공유자
안녕하세요. 독자님.
우선 독자님의 개발환경을 확인코자 합니다.
1) vue 버전이 어떻게 되는지요 ?
2) 섹션-3-4 장고와 폴더 연동하기. 까지는 정상 진행되었는지요 ?
강의 버전과 독자님의 버전이 다른 문제인 듯 합니다.
전화 통화를 원한다면, kimseokhun@gmail.com 으로 전화번호 남겨 주세요.
감사합니다.

별이좋은소년
질문자
현재는 우선은 1. vue.config.js 파일의 최상단에 있는 defineConfig 관련 내용을 지우고 :
const { defineConfig } = require('@vue/cli-service');- set-env-build.bat 스크립트 파일을 만든 후 : 
@echo off
set NODE_OPTIONS=--openssl-legacy-provider
npm run build- package.json 파일을 수정 : - "scripts": { "serve": "vue-cli-service serve", "build": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build", "lint": "vue-cli-service lint" },- 하여 실행이 되긴 합니다. 그러나 npm run build 명령어를 입력하였을 때 파일들이 자동으로 복사가 되진 않습니다 






vue 버전은 5.0.8 입니다!
2. 네 잘 진행 되었습니다!