Error when upgrading to 1.2.0
Closed this issue · 13 comments
When I upgraded to the latest version I got the following error when building my CSS using autoprefixer-loader:
Module build failed: Error: "version" is a required argument.
This is the config inside my webpack.config.js file:
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!autoprefixer-loader!sass-loader?' +
'includePaths[]=' + bourbon + '&' +
'includePaths[]=' + neat)
}
Is it something that I'm missing with the new version? I tried adding ?browsers= but it made no difference.
I'm also being affected with this problem, and reverting to version 1.1.0 seems to fix the problem indeed.
My setup is also quite similar, although i'm not using the ExtractTextPlugin (yet)
Does any of you have a stack trace for this?
ERROR in ./~/css-loader!./~/autoprefixer-loader?browsers=last 2 version!./~/sass-loader?includePaths[]=/Users/couto/Development/REDACTED/app/bower_components&includePaths[]=/Users/couto/Development/REDACTED/app/bower_components/fontawesome/scss&includePaths[]=/Users/couto/Development/REDACTED/app/bower_components/fontawesome/fonts&includePaths[]=/Users/couto/Development/REDACTED/app/bower_components/bourbon/app/assets/stylesheets&includePaths[]=/Users/couto/Development/REDACTED/app/bower_components/neat/app/assets/stylesheets&outputStyle=nested!./app/assets/stylesheets/main.scss
Module build failed: Error: "version" is a required argument.
at Object.getArg (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/node_modules/postcss/node_modules/source-map/lib/source-map/util.js:28:13)
at SourceMapConsumer.BasicSourceMapConsumer (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/node_modules/postcss/node_modules/source-map/lib/source-map/basic-source-map-consumer.js:54:24)
at new SourceMapConsumer (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/node_modules/postcss/node_modules/source-map/lib/source-map/source-map-consumer.js:26:14)
at PreviousMap.consumer (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/node_modules/postcss/lib/previous-map.js:33:34)
at new Input (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/node_modules/postcss/lib/input.js:36:28)
at Function.module.exports [as parse] (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/node_modules/postcss/lib/parse.js:10:17)
at PostCSS.process (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/node_modules/postcss/lib/postcss.js:62:30)
at Autoprefixer.process (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/node_modules/autoprefixer-core/lib/autoprefixer.js:57:36)
at Object.module.exports (/Users/couto/Development/REDACTED/node_modules/autoprefixer-loader/index.js:49:42)
@ ./app/assets/stylesheets/main.scss 4:14-791 12:19-796
webpack: bundle is now VALID.
I am having the same problem (same warning message).
Same error here, happening on both a prod build with ExtractTextPlugin and a dev build without. Going back to 1.1.0 works fine.
Here are the loader configs we're using:
// dev
{
test: /\.sass$/,
loaders: [
"style-loader",
"css-loader",
"autoprefixer-loader?browsers=last 2 version",
"sass-loader?indentedSyntax=sass&includePaths[]=" + path.resolve(__dirname, "../../ui/css")
],
},
{
test: /\.css$/,
loaders: [
"style-loader",
"css-loader",
"autoprefixer-loader?browsers=last 2 version"
]
},
// prod
{
test: /\.sass$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!autoprefixer-loader?browsers=last 2 version!sass-loader?indentedSyntax=sass&includePaths[]=" + path.resolve(__dirname, "../../ui/css")),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!autoprefixer-loader?browsers=last 2 version"),
},
Same here. 1.1.0 is working just fine. Also using sass-loader
I get the error without ExtractTextPlugin
.
Me too.
I'm on vacation. Happy to review a PR and in the meantime, please downgrade to ~1.1
.
An invalid source map is emitted by sass-loader
(maybe actually from node-sass
). To work around it, simply change line 43 to:
if (map && map != '{}') {
Similar code exists in sass-loader
: https://github.com/jtangelder/sass-loader/blob/master/index.js#L56. A proposed fix has been made to sass-loader
is at webpack-contrib/sass-loader/pull/57.
While waiting for either party to fix it, you can use this loader to destroy the source map:
// Destroys the source map from sass-loader.
//
module.exports = function(content) {
this.callback(null, content)
}
Put this loader between autoprefixer and sass: autoprefixer!webpack-map-demolisher!sass
.
sass-loader v0.4.2 is out, and no more interop issues between sass and autoprefixer loaders.
This issue can be closed.
Updating to sass-loader 0.4.2 resolved the issue for me as well.
👍