我有一个项目,我在其中使用 Rollup(生成 bundle.esm.js 文件)捆绑了一个组件库。这些组件然后在另一个项目中使用,该项目生成使用这些组件的网页 - 每个页面使用不同的组件。问题是,整个组件库总是与不同的页面包捆绑在一起,无论我使用的是哪个组件,都不必要地增加了包的大小。
这是我的汇总设置:
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import pkg from './package.json';
const extensions = [
'.js', '.jsx', '.ts', '.tsx',
];
export default [
{
input: './src/base/index.ts',
plugins: [
peerDepsExternal(),
resolve({ extensions }),
babel({
exclude: 'node_modules/**',
extensions,
}),
commonjs(),
],
output: [
{ file: pkg.main, format: 'cjs', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
watch: {
clearScreen: false,
},
}, …Run Code Online (Sandbox Code Playgroud) I have the following html structure:
<div class="parent">
<div class="child1"></div>
<div class="child2"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
The parent is positioned absolutely, child1 and child2 are displayed side-by-side using inline-block. I need this whole thing to be responsive based on the width of the 2 children divs. the problem is, if I increase the width of any of them, the parent's width remains the same. Changing its position to relative fixes this, but I have to have it in absolute. Is there anyway to …
我正在使用pyCharm,并且一直在尝试安装sqlalchemy软件包以帮助我连接到我的mysql数据库。我跑了
pip install flask-sqlalchemy
Run Code Online (Sandbox Code Playgroud)
下载一堆文件后,它成功完成了,但是当我这样做时,该库仍然不可用:
from flask.ext.sqlalchemy import SQLAlchemy
Run Code Online (Sandbox Code Playgroud)
我对python和所有这些东西还很陌生,我不知道该怎么做。安装flask很容易,因为pyCharm帮了我大忙,有什么办法可以做类似的事情吗?
编辑:通过打开pyCharm的首选项,然后转到Project Interpreter,它显示了所有已安装的模块,从而设法做到了这一点。然后只需单击底部的+按钮,然后搜索所需的模块即可。PyCharm从那时起为我做了一切。
是否可以完全禁用WKWebView中的cookie和本地存储?
假设这是我的设置,我想添加一些禁用它们的内容:
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
let myURL = URL(string: "http://bla.com")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}
}
Run Code Online (Sandbox Code Playgroud) 我已将Fresco添加到build.gradle中:
compile 'com.facebook.fresco:fresco:0.9.0+'
Run Code Online (Sandbox Code Playgroud)
每当我尝试构建项目时,我都会收到以下错误:
错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败.
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:bolts/AggregateException.class
如果我删除依赖项,那么错误就会消失.我在搜索中找不到类似的东西.
假设我有一个函数,我需要检查它是否具有某个名称的类方法.例如:
function Foo() {
this.bar = function() {
console.log("I am bar!");
}
}
Run Code Online (Sandbox Code Playgroud)
我想检查Foo类是否实际上有bar方法.我可以创建一个新的Foo实例,然后检查它,我只是想知道是否有更好的方法来做到这一点.