私はJavaScriptフレームワークの設定が比較的新しく、gulp、typescript、およびbabelを使用して書いたライブラリのコンパイル/トランジリレーションを設定しようとしています。私が持っている問題は、外部ライブラリを含むことにあります。私のプロジェクトは、MathJS、RequireJS、RXJS、およびJQueryの使用を目指しています。node_moduleがTypescriptプロジェクトに含まれています
は、コンパイル時には、私は次のエラーを取得:私はロードしようとすると、コンパイル/ transpilationが終了すると Compilation errors
を、私はその後、私のエントリポイント(/services/bid-manager.service.js)とを参照します
package.json
を: Runtime (Chrome conosole) errors私の現在の設定がそうのようになります。ファイル、私は次のエラーを取得します3210
{
"name": "bid-manager-service",
"version": "0.0.1",
"description": "Service for calculating bids for PVBid",
"main": "index.js",
"scripts": {
"test": "test"
},
"keywords": [
"private",
"pvbid",
"bid",
"manager"
],
"author": "Michael J. Miller",
"license": "ISC",
"dependencies": {
"jquery": "^3.1.1",
"mathjs": "^3.6.0",
"requirejs": "^2.3.2",
"rxjs": "^5.0.0-rc.1"
},
"devDependencies": {
"babel-polyfill": "^6.16.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-sourcemaps": "^2.2.0",
"gulp-typescript": "^3.1.2",
"typescript": "^2.0.6"
}
}
tsconfig.json:
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"rootDir": "./src",
"outDir": "./dist",
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules"
]
}
gulpfile.js
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var ts = require('gulp-typescript');
var babel = require('gulp-babel');
var tsProject = ts.createProject('./tsconfig.json');
gulp.task('default', function() {
return gulp.src('src/**/*.ts')
.pipe(sourcemaps.init())
.pipe(ts(tsProject()))
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('release'));
});
そして、私はエラーを取得しています、私のエントリポイントへの最初の数行:
入力文字:
import { AsyncSubject } from 'rxjs/AsyncSubject';
import { Observable } from 'rxjs/Observable';
Transpiled Javascriptを:どのような援助のため、事前に
"use strict";
var AsyncSubject_1 = require('rxjs/AsyncSubject');
var bid_update_service_1 = require('./bid-update.service');
var bid_factory_1 = require('../factories/bid.factory');
ありがとう!