Comments (5)
@darlanalves I think it should be ok to cache the file name along with the dirname of the origin.
The other idea I have is ignoring relative paths altogether, but that could possibly break some code. Still, I think that relative paths are outside the scope of what rollup-plugin-includepaths
should be doing (because relative paths are already handled ok by other resolvers), but that's only an opinion.
from rollup-plugin-includepaths.
Hello buddy :)
Nice spotting here! I'd never notice this bug.
I think it will break some build to completely remove the relative path resolution. Both "absolute" and relative path search are not only reduced to find a given path, but check for alternatives of it, e.g checking for a missing file extension. Removing the feature altogether would lead to a duplication of the plugin just for relative path search.
The simplest solution IMO would be just disable the caching of relative paths. That solves the issue while keeping the feature.
Now, caching the relative paths along with the origin could be better to speedup the search in cases that several modules require one common module in the same folder. It's really ease to add that too, in the method that resolves from cache.
What about this instead?
0b24e60#diff-a4f485aa834ca5b3c24819fceb39c56fL62
from rollup-plugin-includepaths.
No problem, that works too and doesn't break anything. Thanks for the quick reply and a fix!
Btw. would you mind adding any packages that you are using to build the src/plugin.es5.js
version of the plugin? That would be very helpful to potential contributors.
Also, would you consider using Map
for the cache object while we are at that? It's better to use that instead of the plain object for dictionary-like data structures.
from rollup-plugin-includepaths.
Surely :)
I did the plugin while researching the inner workings of rollup, and at time was too lazy to prepare a build setup. Right now I'm just copying/pasting in the Babel REPL and using the ES5 output π
I've published a new version on npm with the fix and a build step. Thanks a lot for finding it π
from rollup-plugin-includepaths.
You're welcome π I will close the issue and the PR as this is sorted out now.
from rollup-plugin-includepaths.
Related Issues (18)
- Resolve `<module-name>/index.js` HOT 4
- Doesn't seem to work with module marked as external HOT 4
- Usage with `commonjs` & `node-resolve`? HOT 2
- Add a `strict` option for path resolution HOT 2
- does not load module index with other extensions HOT 2
- question: How to make it work with eslint? HOT 1
- "external" option doesnβt accept function as value HOT 1
- Breaking changes in updates 0.1.x HOT 1
- Resolve against package.json main field
- Unable to resolve file path? HOT 1
- External option is overrided by the plugin if it is a function HOT 2
- Any interest in supporting TypeScript at some point? HOT 1
- Smart resolve or wildcards HOT 1
- 0.1.4 caused `TypeError: rollupIncludePaths is not a function` on Ubuntu 16.04 HOT 2
- diamond import/export structure fails
- Not working with rollup-plugin-node-builtins HOT 7
- "filepath" does not exist in the hypothetical file system! #772 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rollup-plugin-includepaths.