Css-loader: webpack2 css-loader css-modules

Created on 29 Dec 2016  路  4Comments  路  Source: webpack-contrib/css-loader

versions:

"webpack": "^2.1.0-beta.27",
"css-loader": "^0.26.1"

problem:

I want to custom css-modules localIdentName: localIdentName=[path]___[name]__[local]___[hash:base64:5]

demo:

{
                test: /\.(scss|sass)$/,
                loader: ExtractTextPlugin.extract({
                    fallbackLoader: 'style-loader',
                    loader: [
                    {
                        loader: 'css-loader',
                        query: {
                            modules: true,
                            importLoaders: 1,
                            localIdentName: '[path]___[name]__[local]___[hash:base64:5]'
                        }
                    },
                    'postcss-loader',
                    'sass-loader']
                })
            },

But the localIdentName=[path]___[name]__[local]___[hash:base64:5] of the [path] can't analyze. However, in webpack1.3 can be analyzed out.

result

image

Most helpful comment

If you're using LoaderOptionsPlugin, specify context.

new webpack.LoaderOptionsPlugin({
  options: {
    context: __dirname,
    postcss: ...
  }
})

All 4 comments

If you're using LoaderOptionsPlugin, specify context.

new webpack.LoaderOptionsPlugin({
  options: {
    context: __dirname,
    postcss: ...
  }
})

it work for me. Thank U very much.

Works for me ! thanks.

Is work for me !3Q

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathanong picture jonathanong  路  3Comments

danielgomonea picture danielgomonea  路  3Comments

grydstedt picture grydstedt  路  3Comments

ghost picture ghost  路  3Comments

kcjonson picture kcjonson  路  3Comments