Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 객체
- 기술면접 후기
- Great things take time
- 직귀율
- javascript
- first view
- bom
- 배열
- 반응형 디자인
- 怕不变
- Done is better than perfect
- 사이트 이동 경로
- 레거시 마이그레이션
- 자바스크립트
- 不不怕变
- ADSL
- Array
- 자바스크립트 함수
- pop
- 도메인
- Electronic Commerece
- 중요한건 꺾이지 않는 마음
- javascript function
- 제어문
- 릴리스
- 인공지능
- 퍼스트 뷰
- release
- 내장객체
- 각자의 밤
Archives
- Today
- Total
1일1끄적
[webpack] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.mode should be one of these: "development" | "production" | "none" -> Enable production optimization 본문
개발/에러기록
[webpack] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.mode should be one of these: "development" | "production" | "none" -> Enable production optimization
inkor 2022. 2. 22. 18:12▶날짜: 22-02-20
▶상황&에러내용:
webpack.config.js 에서 설정을 해주고 npm run dev를 실행했을 때 다음과 같은 결과가 발생
webpack-cli 부분이 언급되어있어서 처음엔 package.json에서 설정이 잘못되어있거나, 버젼이 안 맞거나 등 생각하여 다시 인스톨해보고 혹은 저장하면 자동으로 '', "" 으로 수정되는 자동문법 완성이 문제인듯해서 .pritterrc 를 생성해보고 eslint에 대해서 알아보고 이것저것 조치를 취했으나 그대로였다.
▶해결방법: https://webpack.js.org/configuration/mode/
Mode | webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.
webpack.js.org
해당 문서를 보고 자세히 살펴보니 webpack.config.js에서 mode: 'devlopment' 부분에서 오타가 있었다.
If not set, webpack sets production as the default value for mode. =>
만약 설정을 해주지 않으면 pruduction을 기본으로 설정하는 듯 했다.
// webpack.development.config.js
module.exports = {
mode: 'development',
};
// webpack.production.config.js
module.exports = {
mode: 'production',
};
// webpack.custom.config.js
module.exports = {
mode: 'none',
};
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
// If you want to change the behavior according to the mode variable inside the webpack.config.js,
// you have to export a function instead of an object:
var config = {
entry: './app.js',
//...
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {
config.devtool = 'source-map';
}
if (argv.mode === 'production') {
//...
}
return config;
};
※ 결과

'개발 > 에러기록' 카테고리의 다른 글
[webpack/devServer] Cannot GET / (0) | 2022.02.22 |
---|---|
[webpack/npm] npm ERR! code ETIMEDOUT (0) | 2022.02.17 |
[VSCODE/ESLINT] Delete `␍` prettier/prettier (0) | 2022.02.15 |
[webpack]Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. ~ (0) | 2022.02.14 |
[parcel]: 이 시스템에서 스크립트를 실행할 수 없으므로~ 파일을 로드할 수 없습니다. (0) | 2022.02.09 |
Comments