草庐IT

find_module

全部标签

javascript - Babel 不转译从 'node_modules' 导入的模块

我在从node_modules导入模块时遇到问题。由于某种原因,Babel不会转译从node_modules导入的模块,而是转译从src导入的模块。这是一个示例repo:https://github.com/NikitaKA/babeltestma​​in.js//resultcodecontainsconstandlet,butitshouldn't.:(index.jsimportqsfrom'query-string;//nottranspiledimportlibfrom'./lib'//transpiledconstquery=qs.parse(window.location

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声明中?

javascript - 在 ES6 : "Failed to resolve module specifier "vue""中导入包

尝试遵循一些Vue教程,但我目前无法在.js文件中导入Vue,然后在我的index.html中导入此文件。这就是我在index.html中导入脚本的方式:如果我在我的main.js文件中这样做:importVuefrom'vue';我在浏览器控制台中收到以下错误:UncaughtTypeError:Failedtoresolvemodulespecifier"vue".Relativereferencesmuststartwitheither"/","./",or"../".如果我的导入行:importVuefrom'../../node_modules/vue';然后我得到一个不同的

javascript - vueJS + webpack : importing fonts, CSS 和 node_modules

我开始使用Vue.js和Webpack,我对如何正确导入和引用我的字体、CSS和node_modules有一些疑问。我使用vue-cli启动了我的应用程序,结果结构如下:buildconfignode_modulessrc--assets--components--routerstatic这是我的webpack.base.conf文件:varpath=require('path')varutils=require('./utils')varconfig=require('../config')varvueLoaderConfig=require('./vue-loader.conf')

javascript - AngularJS 错误 :Module 'ngResource' is not available! 您拼错了模块名称或忘记加载它

我正在尝试从angularjs进行服务调用。我下载了angularseedproject.并且在view1.js里面写了下面的代码来调用服务:'usestrict';angular.module('myApp.view1',['ngRoute','ngResource']).config(['$routeProvider',function($routeProvider){$routeProvider.when('/view1',{templateUrl:'view1/view1.html',controller:'View1Ctrl'});}]).factory('Entry',['

javascript - Jest : cannot find module required inside module to be tested (relative path)

我有这个组件:importReactfrom'react';importVideoTagfrom'./VideoTag';importJWPlayerfrom'./JWPlayer';classVideoWrapperextendsReact.Component{//...componentcode}基于某些逻辑在内部呈现另一个组件(VideoTag或JWPlayer)但是当我尝试在一个Jest文件中测试它时我得到错误:找不到模块'./VideoTag'这三个组件在同一个目录中,这就是为什么当我转译它并在浏览器中看到它在运行时它实际上有效但看起来Jest在解析这些相对路径时遇到问题,这

javascript - 带有 .find() 的正则表达式,没有结果

我正在尝试更改页面上的id和name属性。我使用的代码是这样的:varimg=newRegExp('id*="launch_pad_image_slide_\d"',g);$('.slider-data').each(function(){$(this).find(img).attr('id','randomstuff');});假设.find函数应该获取里面的整个id:id="launch_pad_image_slide_2"...但它不起作用。5个小时就这样,累坏了。建议?基本上每次删除一个字段时,jQuery都必须遍历它们并正确编号它们的id/name属性以避免重复。

javascript - jquery find() 等效于 javascript

我有三个表,我想检查它们是否包含特定元素,例如一个值为“Previous”的按钮。我通过使用jquery函数find并编写一个函数解决了它,但是我需要在没有jquery的情况下解决这个问题。这可能吗?vart1=document.getElementById("table_one");vart2=document.getElementById("table_two");vart3=document.getElementById("table_three");has_prev_button(t1);has_prev_button(t2);has_prev_button(t3);funct

javascript - D3 : Finding the area of a geo polygon in d3

我有一张使用geoJSON文件绘制国家/地区的map。然后我想画一个以每个国家为中心的圆圈。但是对于有多个边界区域的国家(美国有大陆、夏威夷、阿拉斯加),我想要最大边界区域上的圆圈。我试图通过比较不同边界区域的面积来做到这一点,但由于我无法理解的原因,它不起作用。这是来自geoJSON的示例,展示了澳大利亚如何拥有多个边界区域:{"type":"Feature","properties":{"name":"Australia"},"geometry":{"type":"MultiPolygon","coordinates":[[[[145.397978,-40.792549],[146

javascript - Typescript 和 webstorm,缺少 --module 标志

在WebStorm中编辑在VisualStudio上创建的typescript项目时,会出现以下错误:Error:(1,1)TS1148:Cannotcompileexternalmodulesunlessthe'--module'flagisprovided.代码很简单:在文件Test.ts中classhelloWorld{}export=helloWorld;预先感谢您的帮助已编辑我忘了说我用的是MAC。同样在进入帖子后,在我寻求解决方案的过程中,我尝试在VisualStudioCodeforMac中编译网页,我在那里遇到了同样的问题,那个,让我意识到问题不是IDE,而是一些东西共