我正在使用样式组件构建一个包含rollUp的包.
我的rollup.config.js看起来像:
import resolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
export default {
input: 'src/index.js',
output: {
file: 'dist/bundle.js',
format: 'cjs'
},
external: [
'react',
'react-proptypes'
],
plugins: [
resolve({
extensions: [ '.js', '.json', '.jsx' ]
}),
commonjs({
include: 'node_modules/**'
}),
babel({
exclude: 'node_modules/**'
})
]
}
Run Code Online (Sandbox Code Playgroud)
我收到了
[!] Error: 'isValidElementType' is not exported by node_modules/react-is/index.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
node_modules/styled-components/dist/styled-components.es.js (7:9)
5: import stream from 'stream';
6: import PropTypes from 'prop-types';
7: import { isValidElementType } from 'react-is'; …
Run Code Online (Sandbox Code Playgroud) 我正在尝试运行我的测试:sbt然后测试.
我的build.sbt看起来像这样
lazy val scalatest = "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
lazy val root = (project in file(".")).
settings(
name := "highlight2pdf",
version := "0.1",
scalaVersion := "2.11.6",
libraryDependencies += scalatest
)
Run Code Online (Sandbox Code Playgroud)
我只是将示例测试放在test/scala上
import collection.mutable.Stack
import org.scalatest._
class ExampleSpec extends FlatSpec with Matchers {
"A Stack" should "pop values in last-in-first-out order" in {
val stack = new Stack[Int]
stack.push(1)
stack.push(2)
stack.pop() should be (2)
stack.pop() should be (1)
}
it should "throw NoSuchElementException if an empty stack …
Run Code Online (Sandbox Code Playgroud) 在react-apollo 2.0.1中,我有一个如下所示的graphql类型:
type PagedThing {
data: [Thing]
total: Int
}
Run Code Online (Sandbox Code Playgroud)
在执行以下writeFragment时
client.writeFragment({
id,
fragment: gql`
fragment my_thing on Thing {
status
}
`,
data: {
status
}
})
Run Code Online (Sandbox Code Playgroud)
缓存未更新,新数据未显示在UI上.还有什么需要做的吗?
PS:为了安全起见,我使用了片段匹配
编辑1:
我收到错误:
无法匹配片段,因为缺少__typename属性:{"status":"online"}
所以我将代码更改为:
client.writeFragment({
id,
fragment: gql`
fragment my_thing on Thing {
status
}
`,
data: {
__typename: 'Thing',
status
}
})
Run Code Online (Sandbox Code Playgroud)
并且不会抛出任何错误,但更新仍然不会发生
在 webpack 世界中,我可以使用file-loader按以下方式将图像作为 url 进行捆绑和访问
就像这样:
const webpackConfig = {
// ...
module: {
rules: [
{
test: /\.(jpg|png|svg)$/,
use: [
{loader: 'file-loader?name=[path][name].[hash].[ext]'}
],
include: paths
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
并在反应组件上像这样使用它,例如:
import foo from 'assets/images/foo.png'
function ReactFunctionalComponent () {
return (<img src={foo} />)
}
Run Code Online (Sandbox Code Playgroud)
这会将 foo 与图像的路径放在一起
有没有办法在 rollup js 上执行相同的操作,以便我可以将图像资源作为 URL,并在包内包含哈希值?
在具有 16GB 内存的 macOs 13.2.1 上运行 eslint 似乎在第一次解析时挂起并在 Vs Code 上崩溃。
命令
DEBUG=eslint:*,eslintrc:* npx eslint --fix apps/**/*.ts
Run Code Online (Sandbox Code Playgroud)
挂起输出,例如
eslint:linter Verify +1ms
eslint:linter With ConfigArray: someFile.app.ts +0ms
eslint:linter Parsing: someFile.app.ts +1ms
Run Code Online (Sandbox Code Playgroud)
该文件非常简单,有 9 个位置
eslint 的 VS 代码输出显示内存不足错误
<--- Last few GCs --->
[14915:0x130008000] 253332 ms: Scavenge 16144.8 (16413.5) -> 16141.4 (16430.8) MB, 22.5 / 0.0 ms (average mu = 0.603, current mu = 0.886) allocation failure
[14915:0x130008000] 268734 ms: Mark-sweep 16154.7 (16430.8) -> 16145.6 (16437.8) MB, 15312.6 / 0.0 ms …
Run Code Online (Sandbox Code Playgroud) 我打算让一个PHP Web服务接受基于TLS(HTTPS)的JSON-RPC.每个客户端都有一个API密钥,我将用于识别目的.这是否足够安全,是否有JSON-RPC安全特定标准?
我试图让一个用 maven 构建的 java 程序在 docker-compose 场景上运行,并在我进行更改时进行热重新加载。我在原始 libvm 之上添加了trava-jdk libvm,并在适当的位置添加了 hotswapagent lib。当我运行 java -version 时它给了我想要的东西
Starting HotswapAgent '/usr/local/openjdk-11/lib/hotswap/hotswap-agent.jar'
HOTSWAP AGENT: 10:18:24.771 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.4.0} - unlimited runtime class redefinition.
HOTSWAP AGENT: 10:18:24.992 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [JdkPlugin, Hotswapper, WatchResources, ClassInitPlugin, AnonymousClassPatch, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Omnifaces, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, GlassFish, Vaadin, Wicket, CxfJAXRS, FreeMarker, Undertow, MyBatis]
openjdk …
Run Code Online (Sandbox Code Playgroud) 我有一个类似于数码相框的应用程序.它展示了一个静态网站,只是一个显示本地HTML的webview.我希望它运行得非常出色,我已经获得了唤醒锁,但它确实在某个时候应用程序不断被杀死.我如何阻止android杀死我的长期活动?
我在mogoose中进行查询,如果我在查询选择中添加任何参数,则populate参数会丢失,例如我有以下模式:
部门:
var mongoose = require('mongoose');
var schema = mongoose.Schema({
name: {type:String,required: true,index: {unique: true}} ,
text: String
})
module.exports=mongoose.model('Department',schema);
Run Code Online (Sandbox Code Playgroud)
雇员:
var mongoose = require('mongoose');
var ObjectId=mongoose.Schema.ObjectId;
var schema = mongoose.Schema({
name: {type:String,required: true} ,
lastName: {type:String} ,
birthday:Date,
email:{type:String,required: true,index: {unique: true}},
_department:{type:ObjectId,ref:'Department'},
isUser:Boolean
},{ strict:false});
module.exports=mongoose.model('Employee',schema);
Run Code Online (Sandbox Code Playgroud)
如果我做:
var query=mongoose.model('Employee').find();
query.select('email').populate('_department','name');
query.exec(function(err,data){
console.log(data);
});
Run Code Online (Sandbox Code Playgroud)
我得到以下输出
[ { email: 'email@email.com.br', _id: 532e570864803bf505e51c81 } ]
Run Code Online (Sandbox Code Playgroud)
我希望这个:
[ { _department: { _id: 532c77c3485925d806436981, name: 'bar' },
email: 'email@email.com.br',
_id: 532e570864803bf505e51c81,
__v: 0 …
Run Code Online (Sandbox Code Playgroud)