1

저는 Closure Tools을 처음 사용합니다. 이 경우 나는이 같은 프로젝트 구조가 있습니다calcdeps.py로 클로저 프로젝트를 빌드 할 때 "예외 : 중복 제공"

예외 : 중복 (ClosureSample를) 제공에 (D

Closure project directory screenshot

가 결합하고 내 프로젝트를 컴파일 calcdeps.py를 사용하여,이 예외를 가지고 : \ 테스 압축 \ CSS \ 스택 \ sample2.js, sample2.js) 내가 calcdeps.py를 호출하려면 다음 명령을 사용

:

python calcdeps.py -i sample.js -p "D : \ Tes compress"-p sample2.js -o 컴파일 된 -c 컴파일러 .jar -f --js = 샘플 _ 렌밍 _map.js -f --compilation_level = ADVANCED_OPTIMIZATIONS -f --warning_level = VERBOSE -f --externs = JQuery와 - 1.7.js -f --js_output_file = sample_compiled.js

답변

2

네임 스페이스 ClosureSample는 모든 걸쳐 goog.provide() 하나의 호출에 의해 제공되고 있는지 확인 JavaScript 소스 파일 : sample.js, sample2.js 등. 둘 이상의 파일에 goog.provide('ClosureSample') 행이 있으면, 중복 제공 예외가 수신됩니다.

// Ensure that the same namespace isn't provided twice. This is intended 
// to teach new developers that 'goog.provide' is effectively a variable 
// declaration. And when JSCompiler transforms goog.provide into a real 
// variable declaration, the compiled JS should work the same as the raw 
// JS--even when the raw JS uses goog.provide incorrectly. 

명령 행 호출에서이 파일이 이미 경로 -p "D:\Tes compress으로 포함되어 있기 때문에 당신이 -p sample2.js을 제거 할 수 있습니다 :

폐쇄의 base.jsgoog.provide()의 정의 내에서 다음 주석을 포함한다.

참고 : calcdeps.py 스크립트가를 사용되지 않습니다. 새 권장 종속성 해결 스크립트 closurebuilder.py,에 대한 자세한 내용은 ClosureBuilder 사용을 참조하십시오.

관련 문제