草庐IT

feature_importance

全部标签

javascript - ionic 未捕获错误 : Cannot find module "." when importing a service provider

我正在尝试导入一个新的服务提供者,这是我在从我的ionic应用程序的最新分支中拉取后刚刚创建的。当我尝试导入这行代码时:import{AuthServiceProvider}from'../providers/auth-service'在app.module.ts中,我总是收到一条错误消息:UncaughtError:Cannotfindmodule"."atwebpackMissingModule(index.js:3)ate.code(index.js:3)atObject.(index.js:9)at__webpack_require__(bootstrap62d6a589782

javascript - Webpack2 不理解我的 SASS 文件中的 @import 语句(How to compile SASS with webpack2?)

UsingWebpack2和sass-loader4.11webpack--configwebpack.config.js这是我的webpack.config.jsvarpath=require('path');varsass=require("./sass/lifeleveler.scss");module.exports={entry:'./dist/main.js',output:{filename:'lifeleveler.app.js',path:path.resolve(__dirname,'dist')},watch:true,watchOptions:{aggregat

javascript - NPM 包 : best practices and exposing multiple import paths

我创建了一个使用Webpack和Babel进行转译/捆绑的NPM包。在我的package.json中,我将main设置为"main":"build/index.js"。在我的Webpack配置中,我将条目设置为entry:{app:'./src/index.js'}。我的条目文件如下所示。安装包后一切正常。但是,使用此设置,每个助手都会公开两个导入路径:对于支持自动导入的编辑器来说这是个问题,因为它们有时会从'my-package/build/utils/helper1'而不是'my的首选路径自动导入-包”。那么,两个问题:有什么方法可以防止较长的导入路径暴露出来吗?什么是创建NPM包

javascript - 'require' 与 'import' es6 有何不同?

我遇到了一种我无法解释的行为。根据使用import或require,此测试成功(import)或失败(require)。如果失败,我有以下错误:PhantomJS2.1.1(Windows70.0.0)immutabilityanumberisimmutableFAILEDundefinedisnotaconstructor(evaluating'expect((0,_immutable.List)([1])).toEqualImmutable((0,_immutable.List)([1]))')代码如下:import{Map,List}from'immutable';constex

javascript - 在 Webpack 4 中,我们可以使用 import() token 动态生成页面 block ,以便我们可以将 react 组件转换为可 react 加载的组件吗?

我们使用React和react-loadable.在我们的应用程序初始化期间,我们正在验证component.preload每个都存在方法我们定义。如果缺少该方法,我们会显示一条警告,表明该组件应该是可加载的。我们使用webpack4,有没有办法自动包装组件,所以我们不必手动做?这是一个组件的样子:/**MyComponent.js:pagecomponent*/exportdefault()=>Helloworld;这是包装在react-loadable组件中的同一个组件:/***preconfiguredreact-loadable*Seehttps://github.com/ja

javascript - Openlayers 3 : how to select a feature programmatically using ol. 交互。选择?

我正在使用OpenLayersv3.6(这很重要,因为我发现的大多数解决方案都可能适用于OpenLayers2)。我有一个表格,当我在该表格中选择一行时,我想突出显示/选择OpenLayersmap上的相应要素。所有要素都是位于同一矢量图层(ol.layer.Vector)中的简单多边形(ol.geom.Polygon)。我像这样设置选择交互://thereisalotofothercodehere...addSelectListener:function(){this.SelectInteraction=newol.interaction.Select({condition:ol.e

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 - browserify 入门 : import local files?

我一直在制作一个JavaScript应用程序的原型(prototype),现在我想使用browserify进行更强大的设置,并使用require管理依赖项。目前我的应用程序中有以下文件:chart.jsform.jshighcharts-options.jsvendor/highcharts.jsjquery.jshighcharts-options.js基本上是一个常量列表,而chart.js看起来像这样......varmyChart={setup:function(data){...this.render(data);},render:function(data){...}},和

javascript - 在谷歌地图 javascript v3 中使用 feature.forEachProperty() 的例子?

有人可以提供forEachProperty()的示例吗?https://developers.google.com/maps/documentation/javascript/reference#Data.FeatureforEachProperty(callback:function(*,string))Repeatedlyinvokesthegivenfunction,passingapropertyvalueandnameoneachinvocation.Theorderofiterationthroughthepropertiesisundefined.要么是我的谷歌搜索有缺陷

javascript - import 不能在 chrome 61 中使用?

我想在最新发布的chrome版本chrome61中发挥ES6功能,在使用import关键字时遇到了错误。从技术上讲,import用作以下方法,但控制台显示错误:importMymodulefrom"Mymodule.js"控制台打印:UncaughtSyntaxError:Unexpectedidentifier我已经开启了以下实验性功能:chrome://flags/#enable-javascript-harmonychrome://flags/#enable-module-scripts接着是:chrome://flags/#disable-javascript-harmony-