Skip to content

Issue with css-loader when passing options with function prop #58

Closed
@ShinyChang

Description

@ShinyChang

Environment

OS: Mac OS 10.14
css-loader: 2.1.0
thread-loader: 2.1.2
webpack: 4.28.4

Description
The getLocalIdent which is a custom function in the option of css-loader. It appear in the thread-loader option but not in the css-loader option. As below image shows:
image

loader configuration:

    'cache-loader',
    {
      loader: 'thread-loader',
      options: workerPool
    },
    {
      loader: 'css-loader',
      options: {
        context: path.resolve(__dirname, '..', '..', 'src'),
        modules: true,
        exportOnlyLocals,
        localIdentName: '[path]__[name]__[local]',
        getLocalIdent: (context, localIdentName, localName) => genLocalIdent(localName, context.resourcePath),
        importLoaders: 2
      }
    },
    'postcss-loader',
    {
      loader: 'sass-loader',
      options: {
        outputStyle: 'expanded',
        includePaths: [
          path.resolve(__dirname, '..', '..', 'src/component-library/_styles'),
          path.resolve(__dirname, '..', '..', 'src/css')
        ]
      }
    }

It works fine without thread-loader, so I think this should be thread-loader issue.

Please checkout sample repo and test it

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