Closed
Description
Extraction of CSS works absolutely OK.
But when I use "lang='sass'" I get this:
ERROR in ./~/extract-text-webpack-plugin/loader.js?{"remove":true}!./~/css-loader!./~/sass-loader!./~/vue-loader/lib/style-rewriter.js!./~/vue-loader/lib/selector.js?type=style&index=0!./src/App/app.vue
Module build failed: TypeError: content.trim is not a function
at Object.module.exports (D:\OpenServer\domains\test.dev\node_modules\sass-loader\index.js:211:17)
@ ./src/App/app.vue 1:0-229
My webpack.config.js:
var webpack = require('webpack'),
path = require('path'),
BowerPlugin = require('bower-webpack-plugin'),
ExtractTextPlugin = require('extract-text-webpack-plugin');
var EXCLUDE = /node_modules|bower_components/;
module.exports = {
context: path.resolve('src'),
entry: './index.js',
output: {
path: path.resolve('dist'),
publicPath: '/dist/',
filename: 'scripts-bundle.min.js'
},
module: {
preLoaders: [
{
test: /\.js$/,
loader: 'eslint',
exclude: EXCLUDE
}
],
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: EXCLUDE
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css!autoprefixer!sass'),
exclude: EXCLUDE
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('style', 'css!autoprefixer!less'),
exclude: EXCLUDE
},
{
test: /\.css/,
loader: ExtractTextPlugin.extract('style', 'css!autoprefixer'),
exclude: EXCLUDE
},
{
test: /\.html$/,
loader: 'raw',
exclude: EXCLUDE
},
{
test: /\.vue$/,
loader: 'vue',
exclude: EXCLUDE
}
]
},
eslint: {
configFile: path.resolve('.eslintrc')
},
babel: {
optional: ['runtime'],
loose: 'all',
nonStandard: false,
stage: 0
},
vue: {
loaders: {
css: ExtractTextPlugin.extract('css'),
scss: ExtractTextPlugin.extract('css!sass')
}
},
autoprefixer: {
browsers: ['last 2 versions']
},
plugins: [
new BowerPlugin,
new ExtractTextPlugin('styles-bundle.min.css')
],
watch: true,
devtool: "source-map"
};
Tested css extraction on "vue-loader-example". The same problem. Here is config:
var webpack = require('webpack'),
ExtractText = require('extract-text-webpack-plugin');
module.exports = {
entry: './src/main.js',
output: {
path: './dist',
publicPath: '/dist/',
filename: 'build.js'
},
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
}
]
},
vue: {
loaders: {
css: ExtractText.extract('css'),
stylus: ExtractText.extract('css!stylus')
}
},
plugins: [
new ExtractText('build.css')
]
}
if (process.env.NODE_ENV === 'production') {
module.exports.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
} else {
module.exports.devtool = '#source-map'
}
Thanx in advance!
Metadata
Metadata
Assignees
Labels
No labels