soda-x / postcss-plugin-px2rem

postcss plugin px2rem
193 stars 29 forks source link

报错 请问什么原因? #2

Closed shenke119 closed 7 years ago

shenke119 commented 8 years ago
var px2rem = require('postcss-plugin-px2rem');
const px2remOpts = {
    rootValue: 100
};

module: {
        loaders: [{
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'babel',
            query: {
                presets: ['es2015', 'react']
            }
        }, {
            test: /\.css$/,
            loader: 'style-loader!css-loader!postcss-loader'
        }, {
            test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/, 
            loader: 'url-loader?limit=50000&name=[path][name].[ext]'                
        },
        {
            test: /\.less$/,
            loader:  ExtractTextPlugin.extract('style-loader', 'css!less',"postcss-loader")
        }]
    },
    postcss: [px2rem(px2remOpts)]

ERROR in ./js/app.js
Module not found: Error: Cannot resolve module 'postcss-loader' in /Users/shenke/project/ad-seller-h5/js
 @ ./js/app.js 45:0-25

ERROR in ./~/.0.8.4@antd-mobile/lib/tab-bar/style/css.web.js
Module not found: Error: Cannot resolve module 'postcss-loader' in /Users/shenke/project/ad-seller-h5/node_modules/.0.8.4@antd-mobile/lib/tab-bar/style
 @ ./~/.0.8.4@antd-mobile/lib/tab-bar/style/css.web.js 5:0-22

ERROR in ./~/.0.8.4@antd-mobile/lib/wing-blank/style/css.web.js
Module not found: Error: Cannot resolve module 'postcss-loader' in /Users/shenke/project/ad-seller-h5/node_modules/.0.8.4@antd-mobile/lib/wing-blank/style
 @ ./~/.0.8.4@antd-mobile/lib/wing-blank/style/css.web.js 5:0-22

ERROR in ./~/.0.8.4@antd-mobile/lib/list/style/css.web.js
Module not found: Error: Cannot resolve module 'postcss-loader' in /Users/shenke/project/ad-seller-h5/node_modules/.0.8.4@antd-mobile/lib/list/style
 @ ./~/.0.8.4@antd-mobile/lib/list/style/css.web.js 5:0-22
soda-x commented 8 years ago

解决了么?

看报错信息是没有找到对应的 loader

如果确定是这方面的报错的话需要设定 resolveLoader 里面设定下 modulesDirectories