Skip to content

Commit ad8bd24

Browse files
authored
Fix Webpack's misused require function error
A Webpack error is produced when attempting to build projects containing this module: WARNING in ./~/moment-precise-range-plugin/moment-precise-range.js Critical dependencies: 1:37-44 require function is used in a way in which dependencies cannot be statically extracted @ ./~/moment-precise-range-plugin/moment-precise-range.js 1:37-44 The issue goes away if you make this change; while still retaining the original purpose of checking for require (i.e. to ensure it can be called).
1 parent 4954cf1 commit ad8bd24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

moment-precise-range.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if (typeof moment === "undefined" && require) {
1+
if (typeof moment === "undefined" && typeof require === 'function') {
22
moment = require('moment');
33
}
44

0 commit comments

Comments
 (0)