Skip to content

Sass Loading Failing on New Init #642

@joshbodine21

Description

@joshbodine21

If I use lang="sass" in my style tags in my App.vue, Sass fails to load when I npm run dev. This is the case on a completely new project and all the dependencies have been loaded.

ERROR in ./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-cad49406!./~/sass-loader/lib/loader.js?indentedSyntax!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue
Module build failed:
undefined
          ^
      Invalid CSS after "[v-cloak] {": expected "}", was "{"
      in C:\Work\WebProjects\WISCRM\web\src\App.vue (line 226, column 12)
 @ ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-cad49406!./~/sass-loader/lib/loader.js?indentedSyntax!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue 4:14-268 13:3-17:5 14:22-276
 @ ./src/App.vue
 @ ./src/app.js
 @ multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./src/app.js

My webpack.config.js is also the default configuration after initializing a new project. I cannot figure out what is going on?

var path = require('path')
var webpack = require('webpack')

module.exports = {
    entry: './src/app.js',
    output: {
        path: path.resolve(__dirname, './dist'),
        publicPath: '/dist/',
        filename: 'build.js'
    },
    module: {
        rules: [{
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {
                        // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
                        // the "scss" and "sass" values for the lang attribute to the right configs here.
                        // other preprocessors should work out of the box, no loader config like this necessary.
                        'scss': 'vue-style-loader!css-loader!sass-loader',
                        'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
                    }
                    // other vue-loader options go here
                }
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.(png|jpg|gif|svg)$/,
                loader: 'file-loader',
                options: {
                    name: '[name].[ext]?[hash]'
                }
            }
        ]
    },
    resolve: {
        alias: {
            'vue$': 'vue/dist/vue.common.js'
        }
    },
    devServer: {
        historyApiFallback: true,
        noInfo: true
    },
    performance: {
        hints: false
    },
    devtool: '#eval-source-map'
}

if (process.env.NODE_ENV === 'production') {
    module.exports.devtool = '#source-map'
        // http://vue-loader.vuejs.org/en/workflow/production.html
    module.exports.plugins = (module.exports.plugins || []).concat([
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: '"production"'
            }
        }),
        new webpack.optimize.UglifyJsPlugin({
            sourceMap: true,
            compress: {
                warnings: false
            }
        }),
        new webpack.LoaderOptionsPlugin({
            minimize: true
        })
    ])
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions