Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Sagui bundles peerDependency when Importname is not equal peerDependencyname #404

Open
Kadrei opened this issue Oct 5, 2017 · 2 comments

Comments

@Kadrei
Copy link

Kadrei commented Oct 5, 2017

I have a libraryproject (lets call it ProjectA) depending on another project (lets call it ProjectB), but I do not want to have ProjectB bundled inside the package so I added it as a peerDependency.

When I only add it as a peerDependency a build fails because it cannot find ProjectB (which is used inside the package).
But when I add it as a devDependency it will build everything and also bundle the whole(!) ProjectB in the build. What I would expect is that sagui only bundles the dependencies imported which are not peer- & devdependencies.

When I install ProjectB per hand and only mention it as a peerDependency (so removing it from dev- & dependencies) it will still get bundled.

Expected behaviour would be that sagui bundles only dependencies from the dependencies-field and ignores/excludes dependencies from the peerDependencies-field (even though they may be found in the node_modules.
Also as stated before treeshaking does not seem to work.

@Kadrei
Copy link
Author

Kadrei commented Oct 5, 2017

Further Investigation revealed that the problem is not a general bug but a little more tricky.

We imported stuff from ProjectB like so:
import {thing} from 'ProjectB/'
The / is required for PHPStorm (and most likely also WebStorm) to find the Package when clicked on (if ProjectB is scoped).
But now the import does not match what is inside peerDependencies:
'ProjectB/' != 'ProjectB'
So the question is should sagui also externalize ${peerDependency}/?

@Kadrei Kadrei changed the title Sagui bundles Dependencies in node_modules even though they are peerDependencies Sagui bundles peerDependency when Importname is not equal peerDependencyname Oct 5, 2017
@Kadrei
Copy link
Author

Kadrei commented Oct 6, 2017

It also seems to happen when we import from a subdirectory like 'ProjectB/subdir'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant