What is the ~ (tilde) doing in this javascript import?

Tilde (~) used in conjunction with webpack means that a lookup is performed against node_modules to resolve the path.

In other words, it is a predefined alias that resolves to node_modules.

import { IDispatch } from '~react-redux~redux';

is equivalent to

import { IDispatch } from 'relative_path_to_node_modules/react-redux~redux';

EDIT: Unfortunately, I can’t cite any documentation about this, it is based on experience, you’re welcome to edit this post with a more accurate description.

Now I’ve noticed the ~redux part as well, so you might want to check out the other answer, because I’m puzzled there as well.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)