@dryfeld/nunjucks-loader 4.0.3 → 4.0.4

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.
Files changed (2) hide show
  1. package/index.js +10 -9
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -27,20 +27,21 @@ module.exports = function (source) {
27
27
  if (!hasRun) {
28
28
  const query = new URLSearchParams(this.query);
29
29
 
30
- envOpts = query.opts || {};
31
- if (query){
30
+ envOpts = query.get('opts') || {};
31
+ if (query) {
32
32
 
33
33
  env = new nunjucks.Environment([], envOpts);
34
34
 
35
- if (query.config){
36
- pathToConfigure = query.config;
35
+ if (query.get('config')) {
36
+ pathToConfigure = query.get('config');
37
37
  try {
38
- const configure = require(query.config);
38
+ const configure = require(path.resolve(__dirname,'../../../' + query.get('config')));
39
+
39
40
  configure(env);
40
41
  }
41
42
  catch (e) {
42
43
  if (e.code === 'MODULE_NOT_FOUND') {
43
- if (!query.quiet) {
44
+ if (!query.get('quiet')) {
44
45
  const message = 'Cannot configure nunjucks environment before precompile\n' +
45
46
  '\t' + e.message + '\n' +
46
47
  'Async filters and custom extensions are unsupported when the nunjucks\n' +
@@ -59,12 +60,12 @@ module.exports = function (source) {
59
60
 
60
61
  // Specify the template search path, so we know from what directory
61
62
  // it should be relative to.
62
- if (query.root) {
63
- root = query.root;
63
+ if (query.get('root')) {
64
+ root = query.get('root');
64
65
  }
65
66
 
66
67
  // Enable experimental Jinja compatibility to be enabled
67
- if(query.jinjaCompat){
68
+ if(query.get('jinjaCompat')){
68
69
  jinjaCompatStr = 'nunjucks.installJinjaCompat();\n';
69
70
  }
70
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dryfeld/nunjucks-loader",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "A nunjucks loader for webpack.",
5
5
  "main": "index.js",
6
6
  "scripts": {