@rse/nunjucks-cli 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nunjucks.js +8 -6
- package/package.json +1 -1
package/nunjucks.js
CHANGED
|
@@ -139,12 +139,14 @@ const env = nunjucks.configure(inputFile, options)
|
|
|
139
139
|
/* load external extension files */
|
|
140
140
|
if (typeof argv.extension === "object" && argv.extension instanceof Array) {
|
|
141
141
|
for (let extension of argv.extension) {
|
|
142
|
-
let modpath =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
let modpath = path.resolve(extension)
|
|
143
|
+
if (!fs.existsSync(modpath)) {
|
|
144
|
+
try {
|
|
145
|
+
modpath = require.resolve(extension)
|
|
146
|
+
}
|
|
147
|
+
catch (ex) {
|
|
148
|
+
modpath = null
|
|
149
|
+
}
|
|
148
150
|
}
|
|
149
151
|
if (modpath === null) {
|
|
150
152
|
console.error(chalk.red(`nunjucks: ERROR: failed to find extension module: ${extension}`))
|
package/package.json
CHANGED