Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Missing getOptions.js in lib ? #205

Open

Description

@avabardot

Activity

  1. alexander-akait commented on Jan 31, 2022

    @alexander-akait
    Member

    geOptions was removed https://github.com/webpack/loader-utils/releases/tag/v3.0.0

    removed getOptions in favor loaderContext.getOptions (loaderContext is this inside loader function), note - special query parameters like ?something=true is not supported anymore, if you need this please do it on loader side, but we strongly recommend avoid it, as alternative you can use ?something=1 and handle 1 as true

  2. andrralv commented on Feb 25, 2022

    @andrralv

    @alexander-akait can we get a test/example on how to migrate getOptions to the new syntax?

  3. alexander-akait commented on Feb 26, 2022

    @alexander-akait
    Member

    this.getOptions, this is loaderContext inside loader function

  4. AddJunZ commented on Jan 4, 2024

    @AddJunZ

    this.getOptions, this is loaderContext inside loader function this.getOptions

    It really works for me. But I don't think it makes sense to just delete loaderUtils.getOptions(this).

    module.exports = function cultureLoader(source) {
      // get loader options, replace const options = loaderUtils.getOptions(this);
      const options = this.getOptions();
      const { sensitiveWord } = options;
      var callback = this.async();
      callback(null, source.replace(sensitiveWord, ''.padEnd(sensitiveWord.length, '*')));
    }
  5. alexander-akait commented on Jan 4, 2024

    @alexander-akait
    Member

    You should use this.getOptions instead loaderUtils.getOptions(this), now it is a part of webpack logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions