Open cngu opened 6 years ago
I found this: https://github.com/angular/angular-cli/issues/9020#issuecomment-354374450
Which says that this option doesn'T work for autoprefixer <=7
- but we have 7.1
in our dependencies.
Can you check which version is installed in your /node_modules
?
I'm using autoprefixer@7.2.5
.
npm ls autoprefixer
also shows that css-loader > cssnano is using an older version:
new-template@1.0.0 /Users/c/dev/new-template
├── autoprefixer@7.2.5
└─┬ css-loader@0.28.9
└─┬ cssnano@3.10.0
└── autoprefixer@6.7.7 <-- old
But I'm not sure if that is the problem because the stacktrace suggests that caniuse-api is having issues, but it doesn't use autoprefixer and is using the latest version of browserslist.
But I'm not sure if that is the problem
I would assume that's the issue indeed, if autoprefixer <7 doesn't support major
.
https://github.com/ben-eb/cssnano/blob/v3.10.0/package.json#L26
I tested this out locally by adding an npm-shrinkwrap.json
file to override css-loader > cssnano's version of autoprefixer to 7.2.5.
Unfortunately I'm still seeing the same caniuse-api stacktrace above.
Also note that major
is the first and only query I tried and found it not to be working. There could potentially be other broken queries.
Well, it must be something about either autoprefixer or cssnano. None of out code in the webpack config or anwhere else in this template uses the browserslist
. And since npm run dev
works (unless I misunderstood), we can assume that autoprefixer works and it must be cssnano (or one of its dependencies), which is the only one of the two running only during build
.
Okay, we can try this again when the chain of dependencies have updated.
I believe this has to wait for... css-nano v4 - ben-eb/cssnano#365 (breaking changes) css-loader v1 - webpack-contrib/css-loader#654
...and then we can update when they're stable.
If there are no other tasks on your end, feel free to close this issue (or do whatever you usually do to track upstream issues). Thanks for the help!
I'll leave this open to track it.
Environment
npm: 3.10.10 node: 6.11.4
Issue
Build fails when attempting to configure browserslist to use the
last N major versions
query.Repro
1) In
browserslist
in package.json, change:"last 2 versions",
to"last 2 major versions",
2)npm run build
Error