自升级到Webpack 3后,在Travis CI上出现以下错误.
它似乎在我的本地环境中工作正常,但是当我承诺掌握和踢Travis时它现在仍然失败,出现以下错误.
21 06 2017 20:16:31.514:ERROR [config]: Invalid config file!
TypeError: webpack.optimize.ModuleConcatenationPlugin is not a constructor
at Object.<anonymous> (/home/travis/build/.../webpack.prod.config.babel.js:91:3)
at Module._compile (module.js:569:30)
at loader (/home/travis/build/.../node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/travis/build/.../node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
Run Code Online (Sandbox Code Playgroud)
而它正在抱怨的线
// Webpack 3 Scope Hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
Run Code Online (Sandbox Code Playgroud)
并且还在我的package.json ofcourse中将Webpack设置为版本3.
"webpack": "^3.0.0",
Run Code Online (Sandbox Code Playgroud)
而我的Travis yml非常简单
language: node_js
sudo: false
node_js:
- '8'
Run Code Online (Sandbox Code Playgroud) 嘿,我想知道是否有人能指出我如何在ASP.NET 2.0中使用Bit.ly API的一些例子
可能重复:
IE7显示问题(增加额外的上边距)
所以我有以下css
.socialMediaPlugin {
width: auto;
display: block;
.socialMediaPluginFooter {
margin-top: 15px;
margin-bottom: -12px;
Run Code Online (Sandbox Code Playgroud)
}
并标记
<div class="socialMediaPlugin socialMediaPluginFooter">
<div class="socialMediaLinks">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone_share"></a>
<a class="Pinterest"></a>
<a class="addthis_button_email"></a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
而且基本上是保证金最高点:15px; 在socialMediaPluginFooter中除了IE7之外的所有浏览器都能正常工作吗?
如何在图表结束后使用chart.js库阻止最后一个x轴标签导致延长空白区域?
我还附加了我的图表的初始化和选项设置.
this.colors = [{
backgroundColor:"rgba(128, 203, 196,0.45)",
borderColor:"#80cbc4",
pointBackgroundColor: "#80cbc4",
pointBorderWidth: 2,
hoverBorderColor:"#80cbc4",
pointBorderColor:"#fff",
pointRadius: 5,
pointHoverRadius:5
}];
this.options = {
scales: {
yAxes: [
{
id: 'y-axis-1',
type: 'linear',
display: true,
position: 'left',
ticks : {
beginAtZero : true,
fontColor: 'rgba(0,0,0,0.7)',
callback: this.displayNumeric,
fontSize: 13
}
}
],
xAxes: [
{
gridLines : {
display : false
},
ticks : {
callback: value => {
switch (this.period) {
case "hour":
return moment(value).format("hh:mma");
break;
case "day":
return moment(value).format("MMM DD"); …Run Code Online (Sandbox Code Playgroud) 我的应用程序目前使用webpack,angular js和服务工作者.
使用sw-precache插件创建我的服务工作者. https://www.npmjs.com/package/sw-precache-webpack-plugin
服务工作者缓存进展顺利,我可以看到我的静态资源是从chrome dev工具中的serviceworker.js中获取的.
现在,当我运行灯塔报告时,我仍然收到以下错误:
URL responds with a 200 when offline
Run Code Online (Sandbox Code Playgroud)
https://github.com/GoogleChrome/lighthouse
在我开启离线时的Dev工具中,我实际上可以看到我的页面加载.某些第三方脚本的控制台中的某些错误失败.这是没有得到网址响应200的原因,因为我有来自第三方的一些控制台错误,即示例错误:
GET https://fonts.googleapis.com/css?family=Roboto+Slab:300,400,700 net::ERR_INTERNET_DISCONNECTED
Run Code Online (Sandbox Code Playgroud)
这次审计到底要找什么,我该如何实现?
编辑:当我离线打开时,我添加了网络选项卡的图片,因为我说页面加载正常.我注意到我的sw.js是从磁盘缓存加载的,我在其他网站上没有注意到,所以可能是那里的东西.
这里还有sw.js的内容
'use strict';
var precacheConfig = [["/css/app.styles.77e2a0c3e7ac001193566741984a07f0.css","77e2a0c3e7ac001193566741984a07f0"],["/css/vendor.styles.582e79ead0684a8fb648ce9e543ad810.css","582e79ead0684a8fb648ce9e543ad810"],["/favicon.ico","70ef569d9a12f6873e86ed57d575cf13"],["/fonts/MaterialIcons-Regular.eot","e79bfd88537def476913f3ed52f4f4b3"],["/fonts/MaterialIcons-Regular.svg","a1adea65594c502f9d9428f13ae210e1"],["/fonts/MaterialIcons-Regular.ttf","a37b0c01c0baf1888ca812cc0508f6e2"],["/fonts/MaterialIcons-Regular.woff","012cf6a10129e2275d79d6adac7f3b02"],["/fonts/MaterialIcons-Regular.woff2","570eb83859dc23dd0eec423a49e147fe"],["/icons/launcher-icon-2x.png","91896b953c39df7c40b4772100971220"],["/icons/launcher-icon-3x.png","0aee2add7f56559aeae9555e495c3881"],["/icons/launcher-icon-4x.png","b164109dd7640b14aaf076d55a0a637b"],["/images/aa_logo_only.png","b5b46a8c2ead9846df1f1d3035634310"],["/images/developer.png","e8df747b292fe6f5eb2403c7180c31da"],["/images/facebook.png","8ab42157d0974099a72e151c23073022"],["/images/home-bg.jpeg","0a0f7da8574b037463af2f1205801e56"],["/images/logo.png","e8712312e08ca427d79a9bf34aedd6fc"],["/images/map.png","af3443ef4ab2890cae371c7a3de437ed"],["/images/pattern.png","114d593511446b9a4c6e340f7fef5c84"],["/images/twitter.png","99da44949cd33e16d2d551d42559eaf2"],["/index.html","1e9b5c4b3abba7e13d8d28c98cfb3bb5"],["/js/app.d9ada27616bf469d794d.js","8e2fc74de7d5c122ab8f0aca7e31b075"],["/js/vendor.d9ada27616bf469d794d.js","3bbba4569b6f3b88881b0533260905fe"],["/manifest.json","4bea29155995b63a9f2855637c0fe74c"]];
var cacheName = 'sw-precache-v2-45-' + (self.registration ? self.registration.scope : '');
var ignoreUrlParametersMatching = [/^utm_/];
var addDirectoryIndex = function (originalUrl, index) {
var url = new URL(originalUrl);
if (url.pathname.slice(-1) === '/') {
url.pathname += index;
}
return url.toString();
};
var createCacheKey = function (originalUrl, paramName, paramValue,
dontCacheBustUrlsMatching) {
// Create a new URL …Run Code Online (Sandbox Code Playgroud) 所以我的页面上有一个iframe
<iframe width="640" height="360" frameborder="0" allowfullscreen="" src="http://www.youtube.com/xxxxxx">
Run Code Online (Sandbox Code Playgroud)
我想知道如何在此捕获点击事件.Iframe没有设置id或类
我有这样的数组.
[{
PropertyOne : 1,
PropertyTwo : 5
},
{
PropertyOne : 3,
PropertyTwo : 5
},...]
Run Code Online (Sandbox Code Playgroud)
我想最终得到一个像这样的数组,聚合这个数组的所有列,最终像这样.
[{
PropertyOne : 4,
PropertyTwo : 10
}}
Run Code Online (Sandbox Code Playgroud)
如果它是一个列我知道我可以使用.reduce但是看不到我如何处理多个列?
假设我有一个像这样的数组
let arrayOne = [{text="one", value=0},{text="two", value=0}]
let arrayTwo = [{text="two", value=5}]
Run Code Online (Sandbox Code Playgroud)
因此arrayOne将始终是我想要的整个对象集,但所有值都将为 0。arrayTwo将具有该数组的子集,但始终具有值集。我想要的是,如果arrayTwo对象存在,arrayOne则将值复制到该arrayOne对象。
所以最后我想要
let arrayOne = [{text="one", value=0},{text="two", value=5}]
Run Code Online (Sandbox Code Playgroud)
我做了类似的事情,但我觉得我缺少一些 es6 的魔力。
for (let orig of arrayOne) {
arrayTwo.find(item => {
if (item.value == orig.value) {
Object.assign(orig, item);
}
})
}
Run Code Online (Sandbox Code Playgroud) 刚开始使用Flow但似乎无法理解它是什么让我想要添加类型来解析对象,比如道具
即
render({ count }, { displayHelp }) {
Run Code Online (Sandbox Code Playgroud)
抛出一个错误
16: render({ count }, { displayHelp }) {
^^^^^^^^^ destructuring. Missing annotation
Run Code Online (Sandbox Code Playgroud)
当我添加注释时,它仍然会抱怨
17: render({ count: number }, { displayHelp }) {
^^^^^^^^^^^^^^^^^ destructuring. Missing annotation
Run Code Online (Sandbox Code Playgroud)
如果有人能指出的话,我显然在这里遗漏了一些非常简单的东西?
我有一个这样的测试失败,因为没有调用模拟,问题是模拟被调用但在测试完成之前。
test('should submit if proper values', () => {
const spy = jest.fn().mockReturnValue({
data: {
authenticateUser: {
id: 123,
token: 'lol'
}
}
});
mountedWrapper.setProps({
loginMutation: spy
});
expect(spy).not.toHaveBeenCalled();
email.simulate('change', {
target: { name: 'username', value: 'email@test.com' }
});
password.simulate('change', {
target: { name: 'password', value: 'secret' }
});
form.simulate('submit');
expect(spy).toHaveBeenCalled();
});
Run Code Online (Sandbox Code Playgroud)
但是,如果添加以下 setTimeout 我可以让测试通过
setTimeout(() => {
expect(spy).toHaveBeenCalled();
}, 0);
Run Code Online (Sandbox Code Playgroud)
不过,我正在寻找解决上述问题的更好方法。有没有没有 setTimeout 的解决方案?