草庐IT

asset-module

全部标签

javascript - Node JS 在 module.exports 中调用一个 "local"函数

如何在module.exports声明中从另一个函数中调用一个函数?我有MVC结构Nodejs项目和一个名为TestController.js的Controller。我想在Controller中访问方法,但是使用this关键字会出现以下错误:cannotcallmethodgetNameofundefined"usestrict"module.exports={myName:function(req,res,next){//accessingmethodwithincontrollerthis.getName(data);},getName:function(data){//code}

javascript - 错误 : Cannot find module 'jade~'

我是Nodejs的新手。我使用CompoundJs创建了一个crud操作。应用程序运行良好,直到我尝试提醒一个值,之后我收到错误500Error:Cannotfindmodule'jade~'atFunction.Module._resolveFilename(module.js:338:15)atFunction.Module._load(module.js:280:25)atModule.require(module.js:362:17)atrequire(module.js:378:17)如何解决这个问题我的索引#tabsullia(href='#tabs-1')NewLeave

javascript - Angular 翻译 : Child Module translatePartialLoader urlTemplate overrides the Parent Module translatePartialLoader urlTemplate

我必须使用多个具有不同urlTemnplate的translatePartialLoader。我正在使用angular-translate-loader-pluggable。看起来子模块urltemplate覆盖了父模块urltemplate父模块配置$translateProvider.useLoader('$translatePartialLoader',{urlTemplate:__env.hostUrl+'/*****/****/localization/resource_bundle?bundle_name={part}&locale={lang}'});$translate

Rails 3.1 和 Assets 管道的 Javascript 单元测试

我正在寻找适用于Rails3.1的最简单的Javascript单元测试系统,它特别能够开箱即用地使用Assets管道。我尝试过jasminegem的各种变体,包括jasmine-rice、headless-jasmine-webkit。Jasminegem似乎不能与开箱即用的rails3.1一起使用,需要调整各种配置文件。Jasmine-rice和headless-jasmine-webkit都有复杂的依赖关系,需要对配置文件进行更多调整。有什么建议吗?理想情况下,我需要包含HTML/HAML固定装置,并且是headless的,但在这一点上,我会对任何允许我以最少配置测试我的javas

javascript - 未找到 Angular MINERR_ASSET 404

我在控制台上记录了一个错误:GEThttp://localhost:3000/js/lib/angular/MINERR_ASSET404(NotFound)我看到了thispost它说这是没有包含ngRoute模块的结果,但我有!公共(public)/js/app.js:window.app=angular.module('mean-blog-seed',['ngCookies','ngResource','ui.bootstrap','ngRoute','mean-blog-seed.controllers','mean-blog-seed.services']);然后我有一个引用

javascript - 测试 angularjs Controller 时 - 找不到变量 : module/inject by chutzpah

我有angularJsControllerangular.module('App.ctrl.guests',[]).controller('guestsController',['$scope','$http','$location','$timeout','guestsService',function($scope,$http,$location,$timeout,guestsService){$scope.tiles=[];}])和Jasmine测试////////////'usestrict';describe('App.ctrl.guests',function(){vars

javascript - 为什么 Babel 7 不编译 node_modules 文件?

我在IE11SCRIPT1002中有错误:语法错误(类语法问题)。我的两行简单代码:import{struct}from'superstruct';console.log('finished');我不想让我的babel7将类编译成ES5代码我试过写.babelrc文件:{"presets":[["@babel/preset-env",{"targets":{"ie":"11"}}]]}和https://babeljs.io/docs/en/babel-plugin-transform-classes还没修好更新:我试过使用@babel/plugin-preset-es2015转换ES5

javascript - Jasmine 不会从 Assets 管道加载 javascript 文件

我正在开发一个gem,我已经安装了Jasminehttps://github.com/pivotal/jasmine-gem/我所有需要的JS文件都在我的list文件中,位于app/assets/javascripts/application.js//=requireunderscore//=requirebackbone//=require_tree.//vendor//=require_tree.//custom//=require_tree.//templates//=require_tree.//models//=require_tree.//collections//=req

javascript - ES6 类和 module.exports

最近我在nodeJS实现中看到了这种模式,其中我们的模块有以下代码:classFoo{bar(){console.log('bar');}}module.exports=Foo;然后当我做一个require最后说new来创建类的一个实例。varFoo=require(./foo);varmyFoo=newFoo();myFoo.bar();根据我的说法,这种模式将在每次调用时继续创建Foo类的多个实例。另一种模式可能是我在foo.js中习惯的模式。module.exports={bar:function(){console.log('bar');}};然后我只需要调用bar。varfo

javascript - 使用 Moment JS : Cannot find module "./locale" 创建 React 应用程序

刚刚在我的Web应用程序上运行了一个npmupdate,现在MomentJS似乎失败并显示以下消息:Error:Cannotfindmodule"./locale"\node_modules\moment\src\lib\moment\prototype.js:1>1|import{Moment}from'./constructor';不确定在更新之前我使用的是什么版本的MomentJS,但我的应用程序已经运行了几个月。我创建了另一个React应用程序并运行了npminstallmoment--save并修改了源代码以显示时间,但最终出现了与上述相同的错误。不确定是否有使用Create