buttercup / buttercup-browser-extension

:earth_asia: Buttercup browser extension
https://buttercup.pw
MIT License
230 stars 42 forks source link

Adding alias for imports #309

Closed Rafi993 closed 4 years ago

Rafi993 commented 4 years ago

By adding alias for imports code can start importing as

import { performAuthentication } from "src/shared/library/googleDrive";

instead of

import { performAuthentication } from "../../shared/library/googleDrive.js";
perry-mitchell commented 4 years ago

Hmm, I'm not completely convinced that we need this. I've definitely had projects where require statements have many upwards directory references, but 2-levels are kind of on the border for me. I like the clarify and definitiveness of the .. vs an abitrary src directory which doesn't exist, and would need to always be configured in the webpack config to work.

Rafi993 commented 4 years ago

Hmm, I'm not completely convinced that we need this. I've definitely had projects where require statements have many upwards directory references, but 2-levels are kind of on the border for me. I like the clarify and definitiveness of the .. vs an abitrary src directory which doesn't exist, and would need to always be configured in the webpack config to work.

Instead of src it could just be called source which points to actual directory that exists.

perry-mitchell commented 4 years ago

I'll close this for now as I don't feel it's necessary. We don't have a huge problem of deep trees in our imports, so no need to alias anything just yet. Thanks for the suggestion!