use require.resolve instead of path.resolve to resolve path in node_modules
authorDan Allen <dan@opendevise.com>
Fri, 7 Jun 2019 05:15:00 +0000 (23:15 -0600)
committerDan Allen <dan@opendevise.com>
Fri, 7 Jun 2019 05:15:00 +0000 (23:15 -0600)
gulp.d/tasks/build.js

index 89ff28d..2f471c4 100644 (file)
@@ -28,7 +28,7 @@ module.exports = (src, dest, preview) => () => {
         filter: '**/~typeface-*/files/*',
         url: (asset) => {
           const relpath = asset.pathname.substr(1)
-          const abspath = ospath.resolve('node_modules', relpath)
+          const abspath = require.resolve(relpath)
           const basename = ospath.basename(abspath)
           const destpath = ospath.join(dest, 'font', basename)
           if (!fs.pathExistsSync(destpath)) fs.copySync(abspath, destpath)