GithubHelp home page GithubHelp logo

Comments (4)

darlanalves avatar darlanalves commented on July 19, 2024

Hello @runspired! I'm not sure if I get your use case, so correct me here if I'm wrong:

// file a.js placed on file-a/a.js
import B from 'b';
// file index.js placed on b/index.js
// ...

Is this the case?

I'm actually wondering if this /index.js case is good to keep on plugin. It doubles the amount of I/O access and makes the plugin even more slow. I added it to support these imports inside a node module I needed.

Anyway, if I'm not mistaken, I just need to add one more check in this line
https://github.com/dot-build/rollup-plugin-includepaths/blob/master/src/plugin.js#L159

from rollup-plugin-includepaths.

nilssolanki avatar nilssolanki commented on July 19, 2024

I would appreciate this feature as well (coming from webpack, this was really useful), even if it slightly alters the performance.

from rollup-plugin-includepaths.

runspired avatar runspired commented on July 19, 2024

@darlanalves yes, my specific usage is that a different build step has already pushed all needed modules into a tmp directory. So import 'b'; which should resolve to <dir>/b/index.js is unfound.

Beyond that though, it's also how most imports from node_modules are going to behave. The main file is very often an index.

from rollup-plugin-includepaths.

darlanalves avatar darlanalves commented on July 19, 2024

Ok folks! Sorry the delay, busy week. So, I have this layout:

app.js
tmp/file-a/a.js
tmp/b/index.js
// app.js
import {A} from 'file-a/a';

export default A;
// tmp/file-a/a.js

import B from 'b';

class A extends B {}

export { A };
// /tmp/b/index.js
class B {}

export default B;

... and this config file:

import includePaths from 'rollup-plugin-includepaths';

let includePath = includePaths({
    paths: ['tmp'],
    extensions: ['.js']
});

export default {
    entry: 'app.js',
    format: 'cjs',
    dest: 'bundle.js',
    plugins: [includePath]
};

With that, B was included for A, and both included on final bundle. Published a new version on npm already. Let me know if it fixes your issues.

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.