How to get shorter require paths (with variables or another way) to resolve in PhpStorm?

I'm trying to get away from the hell of `require(../../../../something)` in favor of `require(prefix/something)` or similar.

https://github.com/lauripiisang/variable-in-require-does-not-work is a sample project which demonstrates what I've tried and what is known to not work for me.

PhpStorm 2017.3.2
Build #PS-173.4127.29, built on December 22, 2017
JRE: 1.8.0_152-release-1024-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.3

If you need any additional details about my IDE, let me know.

2
1 comment

Dynamically built require() paths are not supported - please vote for https://youtrack.jetbrains.com/issue/WEB-23612 and linked tickets.

the only path aliases supported are webpack aliases (https://webpack.js.org/configuration/resolve/#resolve-alias); PhpStorm also supports resolving paths relative to folders marked as Resource roots

0

Please sign in to leave a comment.