Hacker News new | past | comments | ask | show | jobs | submit login

Lazy question because I seem to remember not finding this in the Webpack documentation:

Can I configure Webpack so that

    require("app/foo")
imports `foo` from my project root, even if my project root folder isn't named `app` (it's something like `src`)?

I mean, I want a namespace prefix for my stuff, but I don't want to set the search path to ".." or whatever.




Yep, you can do this via the webpack alias config object. I personally have "root" pointing to the root directory of my app that is called app. :)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: