GithubHelp home page GithubHelp logo

Comments (5)

fatfisz avatar fatfisz commented on July 19, 2024

@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.

darlanalves avatar darlanalves commented on July 19, 2024

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.

fatfisz avatar fatfisz commented on July 19, 2024

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.

darlanalves avatar darlanalves commented on July 19, 2024

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.

fatfisz avatar fatfisz commented on July 19, 2024

You're welcome πŸ˜„ I will close the issue and the PR as this is sorted out now.

from rollup-plugin-includepaths.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.