Skip to content

Best Practices for overriding loader options #756

@anithri

Description

@anithri

I did this to override css-loader with new options. Is this the way it's meant to be done?

// config/webpack/environment.js
const { environment } = require('@rails/webpacker')

const myCssLoaderOptions = {
  modules: true,
  sourceMap: true,
  localIdentName: '[name]__[local]___[hash:base64:5]'
}
const CSSLoader = environment.loaders.get('style').use.find(function(el){
  return el.loader === 'css-loader'
})

CSSLoader.options = myCssLoaderOptions

module.exports = environment

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