Skip to content

Latest commit

 

History

History
602 lines (332 loc) · 23.6 KB

CHANGELOG.md

File metadata and controls

602 lines (332 loc) · 23.6 KB

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

4.0.0 (2024-04-08)

⚠ BREAKING CHANGES

  • minimum supported webpack version is 5.27.0
  • minimum support Node.js version is 18.12.0
  • the insert option can only be a selector or the path to the module

Migration:

Before:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [
          {
            loader: "style-loader",
            options: {
              injectType: "styleTag",
              styleTagTransform: function (css, style) {
                // Do something ...
                style.innerHTML = `${css}.modify{}\n`;

                document.head.appendChild(style);
              },
            },
          },
          "css-loader",
        ],
      },
    ],
  },
};

After:

insert-function.js

function insert(css, style) {
  var parent = options.target || document.head;

  parent.appendChild(element);
}

module.exports = insert;

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [
          {
            loader: "style-loader",
            options: {
              insert: require.resolve("./insert.js"),
            },
          },
          "css-loader",
        ],
      },
    ],
  },
};
  • the styleTagTransform option can only be the path to the module

Migration:

Before:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [
          {
            loader: "style-loader",
            options: {
              injectType: "styleTag",
              styleTagTransform: function (css, style) {
                // Do something ...
                style.innerHTML = `${css}.modify{}\n`;

                document.head.appendChild(style);
              },
            },
          },
          "css-loader",
        ],
      },
    ],
  },
};

After:

style-tag-transform-function.js

function styleTagTransform(css, style) {
  // Do something ...
  style.innerHTML = `${css}.modify{}\n`;

  document.head.appendChild(style);
}

module.exports = styleTagTransform;

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [
          {
            loader: "style-loader",
            options: {
              styleTagTransform: require.resolve("./style-tag-transform-function.js"),
            },
          },
          "css-loader",
        ],
      },
    ],
  },
};

Bug Fixes

3.3.3 (2023-05-19)

Bug Fixes

  • compatibility with built-in CSS support (#605) (9636f58)

3.3.2 (2023-03-13)

Bug Fixes

3.3.1 (2021-10-21)

Bug Fixes

3.3.0 (2021-09-21)

Features

  • added support for supports(), layer() and media from @import at-rules (b9a600c)
  • allow to pass options to insert function through style.use() (#535) (f8ef63b)

3.2.1 (2021-07-20)

Bug Fixes

  • added the styletagtransform option when it is a module to addBuildDependency (#528) (270513f)

3.2.0 (2021-07-20)

Features

Bug Fixes

  • added the insert option when it is a module to addBuildDependency (#527) (3963c0b)

3.1.0 (2021-07-12)

Features

  • allow to specify the insert option from file, we strongly recommend do it, using the insert option from file will reduce your bundle size, example (#521) (56fc8f0)
  • allow to specify the styleTagTransform option from file, we strongly recommend do it, using the styleTagTransform option from file will reduce your bundle size, example

Bug Fixes

3.0.0 (2021-06-24)

⚠ BREAKING CHANGES

  • minimum supported Node.js version is 12.13.0
  • minimum supported webpack version is 5.0.0
  • the modules.namedExport option was removed, you don't need it anymore, because we respect the modules.namedExport option from css-loader (we just reexport all from css-loader), just remove it
  • the styleTag value of the injectType (default value) option earlier uses singleton style tag by default for IE8-IE9 due limitations (more information), in this release we have disabled this behavior, because these versions of IE are outdated, if you don't support these browsers this change does not affect you, if you require to support IE8-IE9, you can return old behaviour by setting autoStyleTag value for the injectType option (do the same for lazyStyleTag, i.e. change it to lazyAutoStyleTag)

Features

  • added autoStyleTag and lazyAutoStyleTag values for the injectType option for compatibility of work modern and IE8-IE9 browsers
  • added styleTagTransform option for custom processing style tags (useful if you need ponyfill CSS custom properties for IE8-IE10)
  • reduce size of generated code
  • reduce deps

2.0.0 (2020-10-09)

⚠ BREAKING CHANGES

  • minimum supported Node.js version is 10.13.0
  • the esModule option is true by default, you need to change const locals = require('./styles.css')/require('./styles.css') on import locals from './styles.css'/import './styles.css'' (#489) (727a24d)
  • removed support for loaders returning String instead of Array (#491) (7a0ce4c)

⚠ NOTICE

To avoid problems between style-loader and mini-css-extract-plugin because of changing the esModule option to true by default we strongly recommend upgrading mini-css-extract-plugin to 1.0.0 version.

1.3.0 (2020-10-03)

Features

Bug Fixes

1.2.1 (2020-04-28)

Bug Fixes

  • hot module replacement logic for lazy type (#468) (88a5c2b)

1.2.0 (2020-04-24)

Features

  • hot module replacement for css modules (6d14e0a)

1.1.4 (2020-04-15)

Chore

  • update deps

1.1.3 (2020-01-17)

Bug Fixes

1.1.2 (2019-12-25)

Bug Fixes

  • algorithm for importing modules (#449) (91ceaf2)
  • checking that the list of modules is an array (#448) (1138ed7)

1.1.1 (2019-12-20)

Bug Fixes

  • add empty default export for linkTag value (7ee8b04)

1.1.0 (2019-12-20)

Features

Bug Fixes

1.0.2 (2019-12-17)

Bug Fixes

1.0.1 (2019-11-28)

Bug Fixes

  • compatibility linkTag with ES module syntax (#429) (2cdb9c3)

1.0.0 (2019-08-06)

Bug Fixes

Features

  • new injectType option (e2664e9)
  • remove type text/css from style and link element (#399) (b0187d6)

BREAKING CHANGES

  • minimum required Node.js version is 8.9.0
  • minimum required wepback version is 4.0.0
  • the convertToAbsoluteUrls option was removed, you don't need this anymore
  • the attrs option was renamed to the attributes option
  • the transform option was removed without replacement
  • the hmr option was removed, webpack automatically inject HMR code when it is required (when the HotModuleReplacementPlugin plugin was used)
  • the sourceMap option was removed. The loader automatically inject source maps if the previous loader emit them
  • the ref/unref api methods were removed for useable loader, please use the use/unuse api methods
  • the style-loader/url loader was removed in favor injectType option (look the documentation about the injectType option)
  • the style-loader/useable loader was removed in favor injectType option (look the documentation about the injectType option)
  • the singleton option was removed (look documentation about the injectType option)
  • the insertAt option was removed in favor the insert option (look the documentation about the insert option and examples)
  • the insertInto options was removed in favor the insert option (look the documentation about the insert option and examples)

0.23.1 (2018-10-08)

Bug Fixes

  • addStyles: support exports of transpiled transforms (options.transform) (#333) (33aebed)

0.23.0 (2018-08-27)

Features

  • useable: add insertInto support (options.insertInto) (#341) (2588aca)

0.22.1 (2018-08-08)

Bug Fixes

  • addStyles: use var instead of const (IE fix) (#338) (1ca12ab)

0.22.0 (2018-08-07)

Bug Fixes

  • insertInto and insertAt collaboration (#325) (c7d8fec)

Features

0.21.0 (2018-04-18)

Features

0.20.3 (2018-03-09)

Bug Fixes

  • package: update schema-utils v0.4.3...0.4.5 (dependencies) (#308) (9455888)

0.20.2 (2018-02-15)

Bug Fixes

0.20.1 (2018-01-26)

Bug Fixes

0.20.0 (2018-01-26)

Bug Fixes

  • addStyles: check if HTMLIFrameElement exist (#296) (9b46128)
  • index: enable HMR in case locals (css-modules) are unchanged (#298) (3a4cb53)
  • options: add transform option validation ({String}) (23c3567)
  • options: support passing a {Function} (options.insertInto) (e0c4b19)

Features

  • support passing a {Function} (options.insertInto) (#279) (0eb8fe7)

0.19.1 (2017-12-14)

Bug Fixes

  • addStyles: correctly check singleton behavior when {Boolean} (options.singleton) (#285) (2bfc93e)

0.19.0 (2017-10-03)

Features

  • add option to enable/disable HMR (options.hmr) (#264) (378e906)
  • add support for iframes (options.insertInto) (#248) (25e8e89)
  • support 'before' insertions (options.insertAt) (#253) (67120f8)

0.18.2 (2017-06-05)

Bug Fixes

  • url: use loaderUtils.stringifyRequest to avoid invalidating hashes due to absolute paths (#242) (97508ec)
  • Add null check to removeStyleElement (#245) (0a4845c)

0.18.1 (2017-05-23)

Bug Fixes

0.18.0 (2017-05-22)

Bug Fixes

  • stringify the options.transform request (#230) (5888095)

Features

0.17.0 (2017-05-01)

Features

0.16.1 (2017-03-28)

Bug Fixes

0.16.0 (2017-03-22)

Bug Fixes

  • addStyles: update for test for old IE versions (#196) (1f68495)

Features

  • Set custom attributes for tag in url mode (#198) (2c4f427)

0.15.0 (2017-03-21)

Bug Fixes

  • match parens recursively on URLs to not fix embeded calls (#192) (71e0908)

Features

0.14.1 (2017-03-15)

Bug Fixes

  • syntax error in IE10 and below because of const keyword (#190) (01080cf)

0.14.0 (2017-03-15)

Bug Fixes

  • Adds type attr. to the generated link element (2a2f261)
  • fixUrls: add param to fix relative urls (#186) (19959ee)
  • usable: Export locals if available(#128) (e280cb6)

Features

  • tag-attribute: Add support for custom tag attribute (995f3de)