Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flow-maven-plugin: Problem bundling dependency with multiple bower.json #4415

Closed
bisam-rd opened this issue Jul 18, 2018 · 1 comment
Closed

Comments

@bisam-rd
Copy link

bisam-rd commented Jul 18, 2018

  • Description of the bug

When we try to use a web-component that has a bower depency to popper.js (ex: https://github.com/bisam-rd/genesis-popover), we are not able to package the project in production mode.

  • Minimal reproducible example

Use the webjar org.webjars.bowergithub.fezvrasta:popper.js:1.14.3.
With this code:

@JavaScript("frontend://bower_components/popper/dist/umd/popper.min.js")
public class GenesisPopover extends Component  {
   ...
}

The build with the flow-maven-plugin fails.

[Exec Stream Pumper] [INFO] Starting to process frontend files.
[Exec Stream Pumper] [INFO] Will minify frontend files.
[Exec Stream Pumper] [INFO] Will bundle frontend files.
[Exec Stream Pumper] [INFO] Will hash bundle file names.
[Exec Stream Pumper] [INFO] Will copy files to target directory 'D:\Dev\env\b-one-web\web-composite\target\build\frontend-es6'.
[Exec Stream Pumper] [INFO] Starting operations stated above, this might take a while.
[Exec Stream Pumper] [ERROR] Failed to process frontend files.
[Exec Stream Pumper] [ERROR] error: Error: ENOENT: no such file or directory, open 'D:\Dev\env\b-one-web\web-composite\target\frontend\bower_components\popper.js\dist\umd\popper.min.js'

After further investigation, we found that the bower version of popperjs contains two bower.json files in different directories.

Therefore, the method selectCorrectPackage in the maven-flow-plugin randomly selects one of the directories for packaging.

  • Expected behavior

The top most bower.json is used when two bower.json are found in the same webjar ?

  • Actual behavior

Randomly selected directory is packaged.

@bisam-rd bisam-rd changed the title Problem bundling dependency with multiple bower.json flow-maven-plugin: Problem bundling dependency with multiple bower.json Jul 18, 2018
@pekam pekam added this to the 1.0 Maintenance milestone Jul 25, 2018
@SomeoneToIgnore SomeoneToIgnore self-assigned this Jul 31, 2018
@SomeoneToIgnore
Copy link
Contributor

Hey, thank you for the report, the fix is in the review currently.

One tiny things to notice: the package name is popper.js, so you should import is as @JavaScript("frontend://bower_components/popper.js/dist/umd/popper.min.js")

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

No branches or pull requests

3 participants