Skip to content

add logic to prefer prebid modules over external modules in build process #4124

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

Merged
merged 3 commits into from
Sep 3, 2019

Conversation

jsnellbaker
Copy link
Collaborator

@jsnellbaker jsnellbaker commented Aug 28, 2019

Type of change

  • Bugfix

Description of change

Fixes #4120

This PR fixes the build problem with the Prebid.js express module reported in the above issue.

The issue only occurred when you specifically included express with the modules parameter in a build command (eg gulp build --modules=express) and because the module shared a name with one of the project's nested dependencies.

Basically this line here recognized the express module in the node_modules folder and included that path when the overall function was compiling the list of module paths to include for the build. When this path was added to the build process, it had issues trying to find its dependent packages since they were installed in the wrong locations (if we were actually using the package express directly in the project).

By adding a check to only include modules that belong to our project, it avoids adding that other file path and allows the build to proceed as normal.

@snapwich
Copy link
Collaborator

The only thing I'm worried about is that one of the initial requirements when I was implementing the module system was to allow modules to be pulled in from node_modules that way people could publish them and use them from npm or internal registries. It looks like this could break that?

I think we might need a system that, instead of ignoring node_modules (or in this case, things that are not in /modules), it gives priority to local /modules before node_modules. Thoughts?

@jsnellbaker
Copy link
Collaborator Author

@snapwich Thanks for the feedback; I have an idea to implement that type of logic. I'll push in the changes in a little bit.

@snapwich
Copy link
Collaborator

Node require with paths requires v8.9.0+ I think? (that's what the docs say, but I could swear I had issue with anything less than 10) Is that okay?

@mkendall07
Copy link
Member

mkendall07 commented Aug 29, 2019

we are due for an upgrade on node anyway.

"engines": {
    "node": ">=4.0"
  },

is what package.json has. So we should update that as part of this change.

@jsnellbaker
Copy link
Collaborator Author

I updated the node version references to 8.9.0

@jsnellbaker jsnellbaker changed the title add check to only include our modules in build process add logic to prefer prebid modules over external modules in build process Aug 29, 2019
Copy link
Collaborator

@snapwich snapwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bretg bretg merged commit 3f556dc into master Sep 3, 2019
@@ -21,7 +21,7 @@
"author": "the prebid.js contributors",
"license": "Apache-2.0",
"engines": {
"node": ">=4.0"
"node": ">=8.9.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could update https://github.com/prebid/Prebid.js/blob/master/.nvmrc as well to reflect this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanek Thanks for the suggestion. I created a follow-up PR to make this change, #4162

@jsnellbaker jsnellbaker mentioned this pull request Sep 5, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'makeWebpackPkg' errored... Error in plugin 'webpack-stream', modules not found
5 participants