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

webpack config - include src instead of excluding node_modules #846

Merged
merged 1 commit into from
Feb 7, 2018

Conversation

intelliot
Copy link
Collaborator

In the process of working on #840, I found that our webpack config prevents the build script (i.e. yarn build) from working when node_modules exists anywhere in the path.

For example, if ripple-lib is cloned to:

/Users/elliotlee/github/ripple-lib-browser-client/node_modules/ripple-lib

Then webpack will output a file containing this monstrosity:

/* 1 */
...
/***/ (function(module, exports) {

throw new Error("Module parse failed: Unexpected token (47:5)\nYou may need an appropriate loader to handle this file type.\n| import * as schemaValidator from './common/schema-validator'\n| \n| type APIOptions = {\n|   server?: string,\n|   feeCushion?: number,");

/***/ }),
...

The solution to this was found here: webpack/webpack#2031

An alternate fix would be exclude: path.resolve(__dirname, 'node_modules'),. This also works, but I opted to use include instead because it's more explicit (all source files should be under src).

@FredKSchott
Copy link
Contributor

Wow, that is gross. Good catch.

I don't have permissions to review, but +1 for a more explicit include config

@intelliot
Copy link
Collaborator Author

Adding you as a read-only collaborator to see if that allows for reviews :)

Copy link
Collaborator

@wilsonianb wilsonianb left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@intelliot intelliot merged commit 139159b into develop Feb 7, 2018
@intelliot intelliot deleted the webpack-include-src branch February 7, 2018 22:14
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.

3 participants