I hereby claim:
- I am iamakulov on github.
- I am iamakulov (https://keybase.io/iamakulov) on keybase.
- I have a public key ASB2dHz9Wm6YtJySDOi9D6Ir6PGiWzLdvreB2cru45lWJQo
To claim this, I am signing this object:
// This import should be dropped in production, | |
// because it's very large and contains development data | |
// (like locales for all languages). | |
import load from './very.large' | |
export const main = () => { | |
let data = {} | |
if (process.env.NODE_ENV !== 'development') { | |
data = load() |
I hereby claim:
To claim this, I am signing this object:
(Для канала про бизнес: @iamakulov_learning_biz)
Депозиты. Доходность на февраль 2018 года — 1...2% годовых. Это примерно равно или ниже инфляции доллара. Вклады чаще неотзывные (то есть забрать просто так не получится). На короткие вклады процент меньше, плюс нужно платить подоходный налог (если вклад до двух лет).
На примере выпуска №244:
babel-plugin-add-module-exports
generates an incorrect bundle if you use ES modules in the latest versions of Webpack 2 (at least in 2.1.0-beta.27
and .28
). Here’s what to do.
{
"plugins": [
- "add-module-exports"
]
}
This is an example to my article “How webpack’s ContextReplacementPlugin works”
You have the moment.js library, and you have a dynamic import:
require('./locale/' + name + '.js')
// my-app/webpack.config.js | |
{ | |
externals: { | |
'jquery': 'jQuery', | |
/* ↑ With this line, Webpack will replace every | |
* import $ from 'jquery'; | |
* | |
* in your code with approximately | |
* const $ = window.jQuery; | |
* |
In 2017, Chrome, Firefox and Safari added support for passive event listeners. They help to make scrolling work smoother and are enabled by passing {passive: true}
into addEventListener()
.
The explainer mentions that passive: true
works for wheel and touch events. I practically analyzed when passive: true
actually helps:
Event | Works better with passive: true |
Is passive by default |
---|---|---|
wheel ¹ |
Yes (Chrome), No (Firefox) | No (Chrome), No (Firefox) |
touchstart |
Yes (Chrome), ?² (Firefox) | Yes (Chrome), ?² (Firefox) |
Here’s how to make api.my-app.com
available under my-app.com/api
, using CloudFront or Cloudflare.
If both my-app.com
and api.my-app.com
are hosted in AWS, you can route requests to these instances using the CloudFront CDN.
Here’s what you’ll need to do:
// A copy-pasteable useWhyDidYouUpdate hook, adopted from the old & good usehooks.com (http://web.archive.org/web/20230203011511/https://usehooks.com/useWhyDidYouUpdate/). | |
// | |
// This hook will log whenever a component rerenders – and will print the props (or any other values | |
// you passed into it) that have changed between the rerenders. | |
// | |
// Usage: | |
// | |
// function MyComponent(props) { | |
// useWhyDidYouUpdate('MyComponent', props) | |
// |
This is an example to my article “How webpack’s ContextReplacementPlugin works”
Each time webpack encounters a dynamic import like this:
require('./locale/' + name + '.js')