rollup / rollup-plugin-node-resolve

This module has moved and is now available at @rollup/plugin-node-resolve / https://github.com/rollup/plugins/blob/master/packages/node-resolve
MIT License
469 stars 96 forks source link

Symlinks from npm or yarn link resolve to absolute path ID #159

Closed luwes closed 6 years ago

luwes commented 6 years ago

Not sure if this is an issue to be resolved here but when using yarn link or npm link the module id's resolve to the absolute path rather than the symlink path. Plugins like rollup-plugin-babel exclude or include based on that id so when bundling local packages this exclude: 'node_modules/**' for example would not work with the linked packages.

Related: https://github.com/rollup/rollup-plugin-babel/issues/214

The babel plugin would throw an error: Error: An unexpected situation arose...

I fixed this by reverting to "rollup-plugin-node-resolve": "^1.7.3",

cyungmann commented 6 years ago

I believe the problem is this line: https://github.com/rollup/rollup-plugin-node-resolve/blob/74f2e41a1f0ea6e69dada6a8d6ebc9209f058240/src/index.js#L172

@luwes, I think you can fix this (at least in recent versions of rollup-plugin-node-resolve) by setting the option preserveSymlinks in your rollup config.

luwes commented 6 years ago

@cyungmann thank you setting preserveSymlinks in the rollup config did it. (not in this plugin's options but main rollup options)

akonwi commented 6 years ago

I don't see any mention of preserveSymlinks in the rollup docs. (https://rollupjs.org/guide/en#big-list-of-options). How can we get this documented?

thabti commented 6 years ago

@akonwi preserveSymlinks is part of rollup-plugin-node-resolve and not rollup.