mummybot / postcss-strip-inline-comments

Remove inline comments from postcss-scss parser
MIT License
31 stars 3 forks source link

Module build failed: Error: Cannot find module 'postcss-scss' #4

Closed hutber closed 8 years ago

hutber commented 8 years ago

Hey there

Maybe I am putting my config wrong.

    ERROR in ./~/css-loader?sourceMap&importLoaders=1!./~/postcss-loader?parser=postcss-scss!./src/client/scss/pages/_home.css
    Module build failed: Error: Cannot find module 'postcss-scss'

Webpack

'use strict';
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var qs = require('querystring');

//Post CSS 
var precss = require('precss');
var autoprefixer = require('autoprefixer');
var stripInlineComments = require('postcss-strip-inline-comments');

module.exports = {
    devtool: 'eval-source-map',
    entry: [
        'webpack-hot-middleware/client?reload=true',
        path.join(__dirname, 'src/client/js/Kindred')
    ],
    output: {
        path: path.join(__dirname, '/public/'),
        filename: '[name].js',
        publicPath: '/'
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: 'app/index.tpl.html',
            inject: 'body',
            filename: 'index.html'
        }),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify('development')
        }),
        new ExtractTextPlugin("style.css")
    ],
    module: {
        loaders: [{
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'babel',
            query: {
                "presets": ["react", "es2015", "stage-0", "react-hmre"]
            }
        }, {
            test: /\.json?$/,
            loader: 'json'
        },
        {test: /\.png$/, loader: "url-loader?limit=100000"},
        // Images
        {test: /\.jpg$/, loader: "file-loader"},
        {
            test: /\.(eot|svg|ttf|woff|woff2)$/,
            loader: 'file?name=./font/[name].[ext]'
        },
        {
            test: /\.css$/,
            loader: ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap&importLoaders=1!postcss-loader?parser=postcss-scss')

        }]
    },
    postcss: function (webpack) {
        return [stripInlineComments, precss, autoprefixer, require('postcss-simple-vars'), require('postcss-nested', autoprefixer({browsers: ['last 2 versions']}))];
    }
};
mummybot commented 8 years ago

The error d states it cannot find postcss-scss. This plugin requires that module to run, try including it as well. Sorry I'm on holiday for a specific example, but having that in your web pack config should sort it.

hutber commented 8 years ago

That is exactly what was needed, I also missed it where it states it in the opening line of the plugin 💃 Thanks for the reply :)