草庐IT

MODULE_NAME

全部标签

javascript - 无法动态转译 ES 模块 System.config({ transpile : 'transpile-module' })

这是我的tsconfig.js{"compilerOptions":{"experimentalDecorators":true,"emitDecoratorMetadata":true,"moduleResolution":"node","target":"es5","module":"system","noImplicitAny":false,"outDir":"built","rootDir":".","sourceMap":false},"exclude":["node_modules"]我正在使用tsc命令将我的“hello-angular.ts”转译为“hello-angu

javascript - require() : using module. 导出 vs 直接分配给 "this"

我想知道将这两种方法相互对抗时是否有任何优点或缺点:首先.js:this.myFunction=function(){return'herrofirst';}second.js:module.exports=obj={};obj.myFunction=function(){return'herrosecond';}以上两个将被包含并按如下方式使用:应用程序.js:varfirst=require('./first.js');console.log(first.myFunction());varsecond=require('./second');console.log(second.m

javascript - ES6 : No source code for webpack "cheap-module-eval-source-map" and "cheap-module-source-map" only ** WEBPACK FOOTER **

它曾经有效。现在,当我添加一个断点时:saveSnippet:(title,imageUrl,role)=>{debugger;...chrome(53)中的结果是:我尝试使用它并将配置更改为'cheap-module-source-map'和'eval-source-map'和'source-map'。现在只有'eval-source-map'和'source-map'可以工作。webpack.config.js(Webpack1.13.2):varpath=require('path')varwebpack=require('webpack')varCompressionPlugi

javascript - 编译器不抛出 "Cannot find module"错误

在我的项目中我有2个文件:foo.jsconstimage=require('../this/path/is/wrong.png');boo.tsxconstimage=require('../this/path/is/wrong.png');在foo.js中TypeScript正确的发现图片不存在并抛出“Cannotfindmodule”错误,但是对于boo.tsx没有抛出错误所以该错误仅在应用程序崩溃时出现在运行时。如果我只是将boo.tsx重命名为boo.jsTS再次开始按预期抛出错误。这些是我认为可能相关的一些编译器选项:"module":"es2015","target":"

javascript - 私有(private) NPM : How can the latest version of a module be installed?

使用私有(private)npm,常用命令似乎不起作用:npminstall没有特定的@version::issuenpmoutdated::issuenpmupdate::issuenpmviewversions::(还没有发现问题)还要注意npmv,npmshow,和npminfo是aliases这同样行不通我经常不知道我的团队维护的私有(private)模块的最新版本。我会求助于上面列出的命令之一,但它们似乎不起作用。如何在不知道最新版本的情况下安装软件包? 最佳答案 如果我理解你的问题,安装最新的软件包将是:npminsta

javascript - typescript 编译器错误 TS2307 : Cannot find module 'jquery'

我正在关注JSPM入门guide我想安装jquery包,所以我执行下面的命令。jspm安装jquery但是当我尝试像下面这样用typescript导入它时从“jquery”导入$我从typescript编译器中收到一个错误,提示errorTS2307:Cannotfindmodule'jquery'。不仅对于这个库,对于其他库我也遇到同样的错误。 最佳答案 您需要在编译上下文中包含jquery的类型定义,您可以从https://github.com/DefinitelyTyped/DefinitelyTyped中获取它们

javascript - 使用 angular.module 创建 Controller 有什么好处(如果有的话)?

我是angular.js的新手,目前正在编写我的第一个项目。目前我的Controller看起来像这样,例如:functionMyCtrl($scope,MyService){$scope.foo=MyService.doStuff();}他们以这种方式工作得很好(到目前为止),但我浏览了另一个AngularJS应用程序的源代码并注意到他们正在使用angular.module来创建他们的Controller。如果有的话,我为什么要在自己的应用程序中这样做? 最佳答案 如果您的页面上有多个Angular应用程序并且它们具有同名的Cont

javascript - typescript 错误 : Reserved word 'this' used as name

我正在尝试获取thisNode.jsTypeScript定义可以正常工作,但WebStorm给了我一大堆错误,其中包含所有相同的消息:Reservedword'this'usedasname.ThisinspectionreportsonanyusesofJavaScriptreservedwordsbeingusedasaname.TheJavaScriptspecificationreservesanumberofwordswhicharecurrentlynotusedasJavaScriptkeywords.Usingthosewordsasidentifiersmayresu

javascript - Webpack babel-loader runtime : Module build failed: TypeError: this. setDynamic 不是函数

我正在尝试将babel-loader与babel-plugin-transform-runtime一起使用。我已按照以下说明进行操作:https://github.com/babel/babel-loader#babel-is-injecting-helpers-into-each-file-and-bloating-my-code相关代码:rules:[//the'transform-runtime'plugintellsbabeltorequiretheruntime//insteadofinliningit.{test:/\.js$/,exclude:/(node_modules

javascript - AngularJS module.constant() : how to define a constant inside a module only?

在一个页面上,我有几个Angular模块。我为每个模块定义了一个包含模块版本的常量。varmodule1=angular.module('module1').constant('version','1.2.3');varmodule2=angular.module('module2').constant('version','2.0.0');...我虽然在模块内部定义了一个常量。但是当我在module1中使用常量时,我​​得到的值是'2.0.0'...有没有办法定义一个适合模块的常量(或其他任何东西)?编辑:对于替代解决方案,您能否解释一下如何使用它,例如在Controller声明中?