Comments (4)
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.
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.
@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.
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)
- 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
- `resolveCachedPath` ignores `origin` HOT 5
- 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.