Skip to content Skip to sidebar Skip to footer

React, Webpack: Avoid ".." In Import Statements

I'm currently learning react and thus es6/es7 and webpack. Coming from a largely python background I'm annoyed by the folder sensitive path declarations for import statements, i.e.

Solution 1:

I ended up following @zerkms recommendation. resolve.modulesDirectories is the way to go.

Solution 2:

I wrote a loader to accomplish this, https://www.npmjs.com/package/future-require-loader. It will autoload a path anywhere three underscores surround a partial file path ___filename.js___. it also allows folder paths: ___folder/filename.js___. it will attempt to match the first file path that includes the string so you will want to include folders if there could be a conflict.

Post a Comment for "React, Webpack: Avoid ".." In Import Statements"