Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了angularjs – Grunt Typescript找不到角度核心大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

为什么我的Grunt Typescript编译器找不到角度核心?

我想它与路径有关,所以编译器无法在Node_modules目录中找到libs.

错误

建立

Gruntfile.js任务

typescript: {
    all: {
        src: ['typescript/**/*.ts'],dest: 'javascript/frontend',options: {
            target: "es5",module: "system",moduleResolution: "node",emitDecoratorMetadata: true,experimentalDecorators: true,removeComments: false,noImplicitAny: false
        }
}

打字稿/ add.component.ts

import {Component} from 'angular2/core';

@Component({
    SELEctor: 'myTest',template: '<h1>test</h1>'
})
export class AppComponent { }

node_modules

>包括angular2
>包括打字稿

文件路径

app -- node_modules
    -- typescript
         -- app.component.ts
    -- Gruntfile.js
    -- package.json

使用过的libs / frameworks / tutorials

> Grunt Typescript Github
> Angular2 5min Quickstart

解决方法

刚才我遇到了同样的问题.以详细模式运行grunt显示了它从grunt配置生成的ts配置文件内容.仔细观察,结果表明,根本没有使用moduleResolution选项.但是,另一方面,它没有在官方的grunt-typescript页面上描述.

无论如何,长话短说:我已经使用了grunt-ts包而且一切都很顺利!为方便起见,我在下面发布了我的配置:-)

@H_858_18@module.exports = function(grunt) { grunt.initConfig({ ts: { base: { src: ['src/**/*.ts'],dest: 'dist',options: { module: 'system',moduleResolution: 'node',target: 'es5',noImplicitAny: false } } } }); grunt.loadNpmTasks('grunt-ts'); grunt.registerTask('default',['ts']); };

大佬总结

以上是大佬教程为你收集整理的angularjs – Grunt Typescript找不到角度核心全部内容,希望文章能够帮你解决angularjs – Grunt Typescript找不到角度核心所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。