2017-11-02 10 views
0

Angular2 프로젝트를 CLI로 생성 했으므로 프로젝트가 완료되고 모든 * .js 파일을 만들고 싶습니다. * js.map 파일, index.html/index.jsp, 모든 의존 CSS 등 적절한 아키텍처로 dist 폴더에 복사됩니다.Angular CLI 'tsc'명령이 dist 폴더의 index.html, nodemodules, css 등을 복사하지 않습니다.

현재 'tsc'명령을 실행하면 모든 * .js 및 * js.map 파일이 dist에 복사되지만 nodemodules 폴더에는 index.html/jsp 및 css 파일이 복사되지 않습니다.

js와 ts 파일을 브라우저가 이해하기 때문에 서버에 dist 콘텐츠를 배포하기 위해이 파일을 복사해야합니다.

tsconfig :

{ 
    "compileOnSave": false, 
    "compilerOptions": { 
    "outDir": "./dist", 
    "sourceMap": true, 
    "declaration": false, 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "target": "es5", 
    "typeRoots": [ 
     "node_modules/@types" 
    ], 
    "lib": [ 
     "es2017", 
     "dom" 
    ] 
    } 

Package.json

{ 
    "name": "query-builder", 
    "version": "0.0.0", 
    "license": "MIT", 
    "scripts": { 
    "ng": "ng", 
    "start": "ng serve", 
    "build": "ng build", 
    "test": "ng test", 
    "lint": "ng lint", 
    "e2e": "ng e2e" 
    }, 
    "private": true, 
    "dependencies": { 
    "@angular/animations": "^4.4.6", 
    "@angular/common": "^4.2.4", 
    "@angular/compiler": "^4.2.4", 
    "@angular/core": "^4.2.4", 
    "@angular/forms": "^4.2.4", 
    "@angular/http": "^4.2.4", 
    "@angular/platform-browser": "^4.2.4", 
    "@angular/platform-browser-dynamic": "^4.2.4", 
    "@angular/router": "^4.2.4", 
    "angular-font-awesome": "^2.3.7", 
    "bootstrap": "^3.3.7", 
    "core-js": "^2.4.1", 
    "font-awesome": "^4.7.0", 
    "jQuery-QueryBuilder": "^2.4.4", 
    "jquery": "^3.2.1", 
    "primeng": "^4.2.2", 
    "rxjs": "^5.4.2", 
    "zone.js": "^0.8.14" 
    }, 
    "devDependencies": { 
    "@angular/cli": "1.4.9", 
    "@angular/compiler-cli": "^4.2.4", 
    "@angular/language-service": "^4.2.4", 
    "@types/jasmine": "~2.5.53", 
    "@types/jasminewd2": "~2.0.2", 
    "@types/node": "~6.0.60", 
    "codelyzer": "~3.2.0", 
    "jasmine-core": "~2.6.2", 
    "jasmine-spec-reporter": "~4.1.0", 
    "karma": "~1.7.0", 
    "karma-chrome-launcher": "~2.1.1", 
    "karma-cli": "~1.0.1", 
    "karma-coverage-istanbul-reporter": "^1.2.1", 
    "karma-jasmine": "~1.1.0", 
    "karma-jasmine-html-reporter": "^0.2.2", 
    "protractor": "~5.1.2", 
    "ts-node": "~3.2.0", 
    "tslint": "~5.7.0", 
    "typescript": "~2.3.3" 
    } 
} 

각-cli.json

{ 
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 
    "project": { 
    "name": "query-builder" 
    }, 
    "apps": [ 
    { 
     "root": "src", 
     "outDir": "dist", 
     "assets": [ 
     "assets", 
     "favicon.ico" 
     ], 
     "index": "index.html", 
     "main": "main.ts", 
     "polyfills": "polyfills.ts", 
     "test": "test.ts", 
     "tsconfig": "tsconfig.app.json", 
     "testTsconfig": "tsconfig.spec.json", 
     "prefix": "app", 
     "styles": [ 
     "../node_modules/primeng/resources/primeng.min.css", 
     "../node_modules/primeng/resources/themes/omega/theme.css", 
     "../node_modules/font-awesome/css/font-awesome.min.css", 
     "../node_modules/bootstrap/dist/css/bootstrap.css", 
     "../node_modules/jQuery-QueryBuilder/dist/css/query-builder.default.css", 
     "../node_modules/jQuery-QueryBuilder/doc/css/bootstrap.min.css", 
     "../src/app/selectizeFiles/selectize.bootstrap3.css", 
     "../src/app/selectizeFiles/selectize.bootstrap2.css", 
     "../src/app/selectizeFiles/selectize.css", 
     "styles.css" 
     ], 
     "scripts": [ 
     "../node_modules/jquery/dist/jquery.min.js", 
     "../node_modules/bootstrap/dist/js/bootstrap.min.js", 
     "../node_modules/jQuery-QueryBuilder/dist/js/query-builder.standalone.min.js", 
     "../src/app/selectizeFiles/selectize.js", 
     "../src/app/selectizeFiles/selectize.min.js" 
     ], 
     "environmentSource": "environments/environment.ts", 
     "environments": { 
     "dev": "environments/environment.ts", 
     "prod": "environments/environment.prod.ts" 
     } 
    } 
    ], 
    "e2e": { 
    "protractor": { 
     "config": "./protractor.conf.js" 
    } 
    }, 
    "lint": [ 
    { 
     "project": "src/tsconfig.app.json", 
     "exclude": "**/node_modules/**" 
    }, 
    { 
     "project": "src/tsconfig.spec.json", 
     "exclude": "**/node_modules/**" 
    }, 
    { 
     "project": "e2e/tsconfig.e2e.json", 
     "exclude": "**/node_modules/**" 
    } 
    ], 
    "test": { 
    "karma": { 
     "config": "./karma.conf.js" 
    } 
    }, 
    "defaults": { 
    "styleExt": "css", 
    "class": { 
     "spec": false 
    }, 
    "component": {} 
    } 
} 

는 어떻게 만들 수 dist에 복사 된 파일을 서버에 직접 배포 할 것인가?

답변

1

angular-cli를 사용하려면 ng build 명령을 사용해야합니다. 이렇게하면 모든 번들링을 & 묶음으로 처리하고 모든 적절한 파일을 dist 디렉토리에 출력합니다.

은 또한 소스가 ng build --sourcemaps=true

내가 당신의 정확한 요구 (https://github.com/angular/angular-cli/wiki/build)

를 결정하기 위해 자신의 문서 에있는 모든 옵션을 읽을 것이다 매핑 구축 할 수있는 옵션이 있습니다