Closed Bug 1465041 Opened 6 years ago Closed 6 years ago

Heroku webpack builds failing with "Module not found: Error: Can't resolve 'path-to-regexp'"

Categories

(Tree Management :: Treeherder: Frontend, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

The Heroku frontend builds are currently failing after bug 1450039 landed, with: """ 2018-05-25 17:46:21 $ node ./node_modules/neutrino/bin/neutrino build --presets ./neutrino-custom/production.js ... ./~/react-router/es/matchPath.js Module not found: Error: Can't resolve 'path-to-regexp' in '/tmp/build_8651ee17c1b02f146a059c066d7a4745/node_modules/react-router/es' resolve 'path-to-regexp' in '/tmp/build_8651ee17c1b02f146a059c066d7a4745/node_modules/react-router/es' """ (eg https://dashboard.heroku.com/apps/treeherder-stage/activity/builds/6d40a2e4-0996-413e-883c-20427c621d84) From looking into this, it appears to be another bug due to Neutrino v4 having overridden the default webpack module resolution configuration, such that relative path 'node_modules' are not used, and only the root 'node_modules'. (See also bug 1426741 comment 5) I have a WIP for Neutrino 9 to remove this custom modules resolution configuration, but for now we should fix it ourselves in our custom Neutrino configuration.
Meant to say - I believe the reason this failure only happens on Heroku and not Travis, is since Heroku only installs `dependencies` and not `devDependencies`, which presumably affects the way deps are hoisted, thereby exposing this pre-existing Neutrino 4 module resolution issue again.
Commits pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/75d7dfbded400b7a79433f82cdb768f0ed3cb196 Bug 1465041 - Restore default webpack module resolution config Neutrino 4 removes the webpack default module resolution of looking in a relative `node_modules` directory (and then the parent of that directory, and so on), in favour of hardcoding the repo root's `node_modules` and those of the Neutrino preset directories. This is both unnecessary and causes incorrect module resolution, which has bitten us multiple times. https://github.com/mozilla/treeherder/commit/af892c7f5a4c7550bf3f059fc900914cf3377ee0 Bug 1465041 - Remove direct hawk dependency workaround We no longer use Hawk directly, but had kept it as a dependency to work around Neutrino 4's broken module resolution: https://github.com/mozilla/treeherder/pull/3144#discussion_r164726521
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: