如何从本地js或cdn

时间:2016-09-23 11:32:15

标签: angular typescript

我们确实有angular2应用程序,其中有很多组件。 我们在服务器上编译了这个,我们使用outFile属性生成了一个JS文件。

现在我们计划将这个JS包含在不同的应用程序中,其中应用程序可以从生成/包含的JS文件中导入组件。

如果我们在浏览器级别上运行我们的应用程序,这工作正常,但如果我们需要在服务器上编译/转换,那么我们会看到错误,说明找不到相应的模块。

src \ app.module.ts(24,8):错误TS2307:找不到模块' myModuleName'

有人可以帮我解决这个问题吗。

当前tsconfig:



var tsProject = ts.createProject({
    emitDecoratorMetaData: true,
    experimentalDecorators: true,
    target: "es5",
    module: "commonjs",
    moduleResolution: "node",
    removeComments: true,
    sourceMap: true,
    outDir: "myBuild"
});

gulp.task('scripts', function() {
    var tsResult = gulp.src('lib/*.ts')
        .pipe(embedTemplates({
            sourceType: "ts",
            basePath: "./",
            minimize: {
                quotes: true
            }
        }))
        .pipe(tsc(tsProject));
});




0 个答案:

没有答案