小编dag*_*oin的帖子

如何在root webpack文件夹之外输入?

我做了一些测试来处理位于webpack文件夹之外的文件.我有三个简单的文件:

/*entry.js*/
import style from "./style.css";
import string from "./content.js";

console.log(string);
Run Code Online (Sandbox Code Playgroud)
/*style.css*/
body {
    background: beige;
}
Run Code Online (Sandbox Code Playgroud)
/*content.js*/
export default string = "It works from content.js.";
Run Code Online (Sandbox Code Playgroud)

我使用ES6语法,所以我有.babelrc这样的:

{
  "presets": [
    "react",
    "es2015"
   ]
}
Run Code Online (Sandbox Code Playgroud)

这是我的webpack.config.js:var webpack = require('webpack');

var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
  entry: './../outsidefolder/client/wptest/entry.js',
  //entry: './entry.js',
  debug:true,
  devtool:'source-map',
  resolve: {
    extensions: ['', '.js', '.jsx', '.css']
  },
  output: {
    path: __dirname,
    filename: "bundle.js"
  },
  module: {
    loaders: [
      {
        test: /\.js?$/,
        loaders: ['babel']
          },{ …
Run Code Online (Sandbox Code Playgroud)

javascript webpack

6
推荐指数
1
解决办法
2395
查看次数

Jest-如何在babel-jest中使用根斜杠导入?

我正在使用Babel Jest转换我的代码以进行测试。我不知道如何使用相对于项目根目录的路径。

例如,如果我在测试文件中导入以下模块:/imports/ui/myModuleJest抛出错误

Cannot find module 
'/Users/me/dev/myProject/Users/me/dev/myProject/imports/ui/myModule' from 'test.jsx'`
Run Code Online (Sandbox Code Playgroud)

但是,如果我导入一个具有相对路径的模块,例如:../../ui/myModule它起作用。

我的.babelrc

{
  "plugins": [
    "transform-decorators-legacy",
    "transform-class-properties",
    "babel-root-slash-import"
  ],
  "presets": [
    "es2015",
    "react",
    "stage-0"
  ],
  "env": {
    "test": {
      "plugins": [
        "transform-decorators-legacy",
        "transform-class-properties",
        "babel-root-slash-import"
      ],
      "presets": [
        "es2015",
        "react",
        "stage-0"
      ]
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我的笑话配置是:

  "jest": {
    "roots": ["<rootDir>/imports/tests/jest"]
  },
Run Code Online (Sandbox Code Playgroud)

jestjs babeljs babel-jest es6-modules

5
推荐指数
1
解决办法
571
查看次数

如何停止kibana(不作为服务)?

我试图在SSH上停止kibana,kill但它立即重新生成

dagatsoin@dagatsoin.io [~/logstash]# ps aux | grep kibana
533      28778  0.0  0.0   9292   876 pts/2    S+   00:16   0:00 grep kibana
dagatsoin@dagatsoin.io [~/logstash]# kill -kill 28778
-bash: kill: (28778) - Aucun processus de ce type
dagatsoin@dagatsoin.io [~/logstash]# ps aux | grep kibana
533      28780  0.0  0.0   9292   876 pts/2    S+   00:16   0:00 grep kibana
dagatsoin@dagatsoin.io [~/logstash]# 
Run Code Online (Sandbox Code Playgroud)

你怎么杀了这个过程?

linux elasticsearch-plugin kibana

4
推荐指数
2
解决办法
1万
查看次数

如何在流星中使用带有打字稿的 mongo 模式验证?

使用 Typescript 时,是否有在 Meteor 1.3 中使用模式验证的包。Meteor 指南(aldeed:simple-schema)中的推荐包似乎没有定义文件。

那么改用什么,或者 Typescript 有一个内置的方法来做到这一点?

mongodb database-schema node.js meteor typescript

4
推荐指数
1
解决办法
1239
查看次数

如何强制停止logstash?

我通过 SSH 在我的服务器上启动了 Logstash,但与 Elasticsearch 的连接错误。当我尝试 CTRL+C Logstash 并没有停止,他现在仍在运行。我怎样才能强制它停止?

我的服务器运行CentOS5

Got error to send bulk of actions to elasticsearch server at localhost : blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];[SERVICE_UNAVAILABLE/2/no master]; {:level=>:error}
Failed to flush outgoing items {:outgoing_count=>552, :exception=>org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];[SERVICE_UNAVAILABLE/2/no master];, :backtrace=>["org.elasticsearch.cluster.block.ClusterBlocks.globalBlockedException(org/elasticsearch/cluster/block/ClusterBlocks.java:151)", "org.elasticsearch.cluster.block.ClusterBlocks.globalBlockedRaiseException(org/elasticsearch/cluster/block/ClusterBlocks.java:141)", "org.elasticsearch.action.bulk.TransportBulkAction.executeBulk(org/elasticsearch/action/bulk/TransportBulkAction.java:210)", "org.elasticsearch.action.bulk.TransportBulkAction.access$000(org/elasticsearch/action/bulk/TransportBulkAction.java:73)", "org.elasticsearch.action.bulk.TransportBulkAction$1.onFailure(org/elasticsearch/action/bulk/TransportBulkAction.java:148)", "org.elasticsearch.action.support.TransportAction$ThreadedActionListener$2.run(org/elasticsearch/action/support/TransportAction.java:137)", "java.util.concurrent.ThreadPoolExecutor.runWorker(java/util/concurrent/ThreadPoolExecutor.java:1145)", "java.util.concurrent.ThreadPoolExecutor$Worker.run(java/util/concurrent/ThreadPoolExecutor.java:615)", "java.lang.Thread.run(java/lang/Thread.java:745)"], :level=>:warn}
SIGTERM received. Shutting down the pipeline. {:level=>:warn}
^CSIGINT received. Shutting down the pipeline. {:level=>:warn}
^CSIGINT received. Shutting down the pipeline. {:level=>:warn}
^CSIGINT received. …
Run Code Online (Sandbox Code Playgroud)

centos5 centos elasticsearch logstash

3
推荐指数
1
解决办法
2万
查看次数

1M +条目的哪个(近)实时空间数据库?

我正在启动一个分析项目,该项目将处理数百万个地理定位数据.数据可能是这样的:

id{ userId, long, lat, time, appId }

我的主要业务:

  • 获取区域中包含的所有数据
  • 找到所有属于userId的点
  • pub/sub显示所有新条目
  • 在所有数据上添加/删除字段(或只是几个)

我想使用Meteor.js并且需要近乎实时的性能(最多~0.5s到3s).

也许这很重要:我的结果需要3-15米之间的精度.

所以我看了看:

Redis:接缝简单易用,有一个Redis Geo插件.另外还有一个流星驱动程序.

PostGIS: M +条目的实时表现?没有流星的司机.

PostGre:有一个流星驱动程序.

Hbase:为大桌子构建接缝.没有流星的司机.

你会用哪一个?(任何其他建议将不胜感激.)

postgresql hbase postgis geolocation redis

2
推荐指数
1
解决办法
1019
查看次数

连接商店时Mobx.inject和Mobx.observer之间的主要区别是什么?

我开始将我的商店连接到mobx.我想知道使用observer(['store'],...)或使用之间的区别inject('store')(observer(...))

我认为注入的主要区别不是反应性.那么注入观察者的意图究竟是什么呢?

javascript reactjs mobx

2
推荐指数
1
解决办法
683
查看次数

如何完全删除Pixi渲染器,舞台和资产?

我正在尝试使用React安装/取消Pixi舞台(我现在还不想使用react-pixi)

重新安装组件时出现错误:

Uncaught Error: Resource with name "cupCake.png" already exists
i.add.i.enqueueapp.js
componentDidMountmodules.js
_assign.notifyAllmodules.js
ON_DOM_READY_QUEUEING.closemodules.js
Mixin.closeAllmodules.js
Mixin.performmodules.js
Mixin.performmodules.js
_assign.performmodules.js
flushBatchedUpdatesmodules.js
Mixin.closeAllmodules.js
Mixin.performmodules.js
ReactDefaultBatchingStrategy.batchedUpdatesmodules.js
batchedUpdatesmodules.js
ReactEventListener.dispatchEvent
Run Code Online (Sandbox Code Playgroud)

我尝试使用:PIXI.TextureCache['cupCake.png'].destroy(true);但是错误仍然存​​在。

这是我的组件:

class MapOverlay extends React.Component{

  constructor(props) {
    super(props);
  }

  componentDidMount() {
    this.renderer = PIXI.autoDetectRenderer(256, 256, {transparent: true});
    this.refs.gameCanvas.appendChild(this.renderer.view);

    // create the root of the scene graph
    this.stage = new PIXI.Container();
    this.stage.width = 1366;
    this.stage.height = 768;

    PIXI.loader
      .add("cupCake.png")
      .load(()=> {

        //Create the `cat` sprite from the texture
        var cat = new PIXI.Sprite(
          PIXI.loader.resources["cupCake.png"].texture …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs pixi.js

2
推荐指数
1
解决办法
3752
查看次数