-
Notifications
You must be signed in to change notification settings - Fork 920
Closed
Labels
Description
I use webpack2.2.1 in vue1.0.28 , when i use extract-text-webpack-plugin in webpack configuration like this
...
var ExtractTextPlugin = require('extract-text-webpack-plugin')
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
stylus: ExtractTextPlugin.extract({
use: [
'css-loader?{discardComments:{removeAll:true}}',
'stylus-loader'
],
fallback: 'vue-style-loader'
})
},
postcss: [
require('autoprefixer')({
browsers: ['> 0.1% in CN']
})
]
}
}
]
},
...
plugins: [
...
new ExtractTextPlugin({
filename: '[name].[contenthash:8].css',
disable: false,
allChunks: true
})
...
]
...
and it show me this message:
"Module build failed: TypeError: loader.charAt is not a function"
when i remove the extract-text-webpack-plugin like this
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
stylus: 'vue-style-loader!css-loader!stylus-loader'
},
postcss: [
require('autoprefixer')({
browsers: ['> 0.1% in CN']
})
]
}
}
]
}
then it works.
by the way, webpack2.2.1 must use the new version of extract-text-webpack-plugin, so the latest version is
"extract-text-webpack-plugin": "^2.0.0-rc.3",
so, i do not know it is my wrong in somewhere or it is a bug.
please help, thanks a lot!
update at 19:37 in china
I switched the version of "extract-text-webpack-plugin" to "^2.0.0-beta.5" and change my configuration in this code
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
stylus: ExtractTextPlugin.extract({
loader: 'css-loader?{discardComments:{removeAll:true}}!stylus-loader',
fallback: 'vue-style-loader'
})
},
postcss: [
require('autoprefixer')({
browsers: ['> 0.1% in CN']
})
]
}
}
finally, "extract-text-webpack-plugin" works