Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.4.7 broke compatibility #50

Closed
pmlt opened this issue Mar 13, 2017 · 2 comments
Closed

Version 2.4.7 broke compatibility #50

pmlt opened this issue Mar 13, 2017 · 2 comments

Comments

@pmlt
Copy link

pmlt commented Mar 13, 2017

Hello,

You have recently released version 2.4.7 of nunjucks-loader. However, in that release you have incremented the version of your dependency loader-utils from ^0.2.12 to ^1.0.0. This is a breaking change, so your 2.4.7 release violates the rules of semantic versioning.

In effect, this broke the build of multiple projects we are maintaining, because loader-utils version 1.x no longer compiles under the version of node JS we are using. Please fix your release.

@linsolas
Copy link

linsolas commented Mar 15, 2017

Hello,

Not perfectly sure my problem is related to this incompatibility, but with 2.4.7 the loader does not get the query options, while with 2.4.5 everything is OK. In the loaderUtils.getOptions, it expect an object with the query parameter (code here) :

function getOptions(loaderContext) {
	const query = loaderContext.query;
	if(typeof query === "string" && query !== "") {
		return parseQuery(loaderContext.query);
	}
	if(!query || typeof query !== "object") {
		// Not object-like queries are not supported.
		return null;
	}
	return query;
}

However, the nunjucks-loader is giving a string:

   if (!hasRun){
        var query = loaderUtils.getOptions(this.query);

and thus, the query object is null everytime. If I change the previous line to:

   if (!hasRun){
        var query = loaderUtils.getOptions({query: this.query});

then it works as expected.

note: I'm using Webpack 1 in my project and my Webpack configuration is like that:

{
  test: /\.(njk|nunjucks)$/,
  loader: 'nunjucks-loader',
  query: {
    root: __dirname + '/pages',
    opts: {
      tags: {
        variableStart: '{$',
        variableEnd: '$}'
      }
    }
  }

@at0g
Copy link
Owner

at0g commented Mar 18, 2017

v2.4.8 reverts the changes in PR #48 and fixes this mess.
Will look at a 3.x branch for the move to loader utils 1.x

@at0g at0g closed this as completed Mar 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants