webpack/schema-utils

2.7 introduces Unexpected Token error on our build

TheFrogPrince opened this issue · 8 comments

  • Operating System: Azure
  • Node Version: v6.11.2
  • NPM Version: v3.10.10
  • webpack Version: 4.43.0
  • schema-utils Version: 2.7

Expected Behavior

Compile without errors.

Actual Behavior

With the release of 2.7, our nightly builds started failing with:

ERROR in ./wwwroot/source/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
D:_work\66\s\sites\Test\node_modules\schema-utils\dist\util\hints.js:16
const currentSchema = { ...schema
^^^

SyntaxError: Unexpected token ...

Code

ERROR in ./wwwroot/source/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
D:_work\66\s\sites\Test\node_modules\schema-utils\dist\util\hints.js:16
const currentSchema = { ...schema
^^^

SyntaxError: Unexpected token ...

How Do We Reproduce?

I can't actually post our project, obviously. Just letting ya'll know.

Hard-coding the previous version in our package.json file solved the problem:

"schema-utils": "2.6.6",

This

"schema-utils": "2.6.6",

could help other people like us who don't reference your project directly, but rather pick up the reference to your project from some other project.

Shouldn't a bump in required npm version be a major version bump for this lib, not a minor one, for reasons like this? My project's build also failed due to our (company-mandated) use of node 6.9.2, with no code changes on our part, due to a transitive dependency from file-loader to schema-utils.

No. Their node requirement has actually been in there for a while. The trouble is, the Engine has never been enforced by default. I even tried to get it to be enforced on our build, and apparently have to upgrade a bunch of things to even get that to happen (which kinda defeats the point).

Obviously... this is their first check-in using some of the newer features, so they've had a version marked as required that hasn't been required for a long time (until now).

One of the pitfalls of open-source (did you see how quickly my issue here got closed?). :)

We always have engines https://github.com/webpack/schema-utils/blob/v2.0.0/package.json#L12, it is even in README, yarn fails with it, npm output warning, I don't know why you ignore it and shame OSS and us

Thanks guys.

I don't think he was "shaming" you, just pointing out that your node version dependency was always set.

I appreciate you documenting this and sorry I didn't know of the hard dependency, but note that until my build broke today, I was unaware of schema-utils at all, since it's a transitive dependency, so I'm not familiar with its ins and outs. I saw your link to package.json#17 and mistakenly thought it was part of the 2.7 commit. Thanks for the clarification.

Hard-coding the previous version in our package.json file solved the problem:

"schema-utils": "2.6.6",

you resolved my issue , thank you