although if you had a moment.js file in your directory, by default webpack would have prioritized this over your moment Node module
Getting Started with webpack
Drew Powers

This would only be true if your import statement looked like this

import moment from './moment'

Anything not prefixed with a directory structure lookup (e.g. ./../, etc.) is automatically looked for in node_modules as a third-party dependency.

So, theoretically, you could import the MomentJS library and import your own moment file as well

import moment from 'moment'
import localMoment from './moment'

In the case of not having first installed momentJS, webpack would throw an error on that first line that it cannot resolve the module ‘moment’—even if you have a local moment.js file in src.

Really awesome post here! Thanks for creating it :)

Show your support

Clapping shows how much you appreciated Austin Wood’s story.