Add support for node-resolution - #138
Conversation
|
Size Change: +107 B (0%) Total Size: 674 kB
ℹ️ View Unchanged
|
| import { resolve, dirname, join } from 'path'; | ||
|
|
||
| const EXTS = ['.js', '.cjs']; | ||
| const EXTS = ['.js', '.jsx', '.cjs']; |
There was a problem hiding this comment.
I don't think this is allowed by node-resolve, is it?
There was a problem hiding this comment.
Yeah, it isn't allowed by default in @rollup/plugin-node-resolve, but all framework cli's that use JSX have this extension added for resolution. Not having that would mean we'd break support for a good chunk of Preact users.
|
Looks good, and I'm glad to have tests for this. I do think we need to find a way to actively discourage folks from relying on these semantics though. The package.json-in-directory case is particularly tricky though, since there isn't really a spec-compliant way to do that. |
Co-authored-by: Jason Miller <developit@users.noreply.github.com>
Agree, I think the only way to do that is through highlighting the advantages. Supporting node resolution, even though we'd prefer not to, allows users to migrate file by file. Our docs (if we get any) should show paths with the extension for sure 👍 |
|
Closing, this was added a while back and works out of the box. |
This PR adds support for node-style resolution.
/foo->/foo.js/foo->/foo.jsx/foo->/foo.ts/foo->/foo.tsxIndex resolution:
/foo->/foo/index.js/foo->/foo/index.jsx/foo->/foo/index.ts/foo->/foo/index.tsx