[전단 카드 의 최적화 사고방식 과 방안 03] 업그레이드 babel 7 주의사항
babel 문서
babel 의 간단 한 요약 소개, 추천
babel 7 간단 업그레이드 안내
업그레이드 과정 에서 다음 과 같은 문제 가 발생 했 습 니 다.
[email protected] requires a peer of webpack@1 || 2 but none was installed
1. 왜 잘못 신 고 했 어
webpack 1.x | babel-loader <= 6.x
webpack 2.x | babel-loader >= 7.x (recommended) (^6.2.10 will also work, but with deprecation warnings)
webpack 3.x | babel-loader >= 7.1”
1. Plugin / Preset files are not allowed to export objects, webpack 오류 / babel 오류 해결 방법
1. 왜 잘못 신 고 했 어
여기 서 오 류 를 안 고 있 는 것 은 바 벨 의 버 전 충돌 때문이다.
대부분 당신 의 babel 의존 가방 이 호 환 되 지 않 기 때 문 입 니 다.
package. json 의존 목록 을 볼 수 있 습 니 다.
즉, babel 7.0 버 전이 있 는 (@ babel / core, @ babel / preset - react)
bebel - cli 버 전 보기 명령 도 가능 합 니 다 (babel - V)
바벨 6.0 버 전도 있어 요[email protected] , [email protected] , [email protected] )
패키지. json 의존 패키지 에 babel 7.0 버 전이 있 고 babel 6.0 버 전이 있 으 면 이 오 류 를 보고 합 니 다.
두 판본 은 호 환 되 지 않 는 다
2. 처리 방법
babel 에 관 한 모든 가방 을 7.0 버 전 으로 업그레이드 합 니 다.
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-polyfill": "6.26.0",
"babel-preset-env": "^1.2.1",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.5.5", //
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"@babel/runtime": "^7.5.5", //
"babel-core": "^7.0.0-bridge.0", //
"babel-eslint": "^7.2.3",
"babel-loader": "^8.0.0",
3. babelrc 파일 도 수정 해 야 합 니 다.
{
"presets": [
["env", { "modules": false }], //
"stage-2" //
],
"plugins": ["transform-runtime"], //
"comments": false, //
"env": {
"test": {
"presets": ["env", "stage-2"], //
"plugins": [ "istanbul" ]
}
}
{
"presets": [
"@babel/preset-env", //
],
"plugins": [
"@babel/plugin-transform-runtime", //
"@babel/plugin-syntax-dynamic-import" //
],
"env": {
"test": {
"presets": ["env"], //
"plugins": [ "istanbul" ]
}
}
4. webpack. base. conf. js 파일 도 수정 해 야 합 니 다.
...
test: /\.js$/,
exclude: /node_modules(?!\/quill-image-drop-module|quill-image-resize-module)/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
options: { //
presets: ['@babel/preset-env']
}
2.Can't resolve '@babel/runtime/helpers/objectSpread' and '@babel/runtime/helpers/typeof'
1. 왜 잘못 신 고 했 어
해답 링크
홈 페이지 문서 에 도 설명 이 있어 요.
2. 처리 방법
npm add @babel/runtime
3.Requires Babel "^7.0.0-0", but was loaded with "6.26.3"
1. 왜 잘못 신 고 했 어
"babel-core": "7.0.0-bridge.0"
마지막 으로 완전한 package. json 파일 을 붙 여 주세요.
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"@babel/runtime": "^7.5.5",
"ajv": "^6.10.2",
"autoprefixer": "^6.7.2",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^8.0.0",
"bpmn-js-properties-panel": "^0.32.1",
"chalk": "^1.1.3",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.26.1",
"es6-promise-polyfill": "1.2.0",
"eslint": "^3.14.1",
"eslint-config-standard": "^6.2.1",
"eslint-friendly-formatter": "^2.0.7",
"eslint-loader": "^1.6.1",
"eslint-plugin-html": "^2.0.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^0.10.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"function-bind": "^1.1.0",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.19.1",
"less-loader": "4.1.0",
"mini-css-extract-plugin": "^0.8.0",
"opn": "^4.0.2",
"optimize-css-assets-webpack-plugin": "^1.3.0",
"ora": "^1.1.0",
"preload-webpack-plugin": "^2.3.0",
"rimraf": "^2.6.0",
"script-loader": "^0.7.2",
"semver": "^5.3.0",
"stylus-loader": "^3.0.1",
"url-loader": "^0.5.7",
"vue-loader": "11.1.4",
"vue-router": "2.8.0",
"vue-style-loader": "^2.0.0",
"vue-template-compiler": "2.5.16",
"webpack": "^3.8.1",
"webpack-bundle-analyzer": "^2.2.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.16.1",
"webpack-merge": "^2.6.1"
},
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Qiita API v2를 Ajax에서 사용하기위한 webpack 설정 (로컬 개발 환경 전용)에서는 Qiita의 기사 목록, 사용자 세부 정보, 기사를 '좋아요'한 사람 목록 및 재고가 있는 사람 목록을 검색할 수 있습니다. Qiita 화면에서 기사를 재고한 사람을 볼 수 없기 때문에 API를 통해 기사를 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.