All notable changes to this project will be documented in this file. See standard-version for commit guidelines.
4.0.0 (2024-04-08)
- minimum supported webpack version is
5.27.0 - minimum support Node.js version is
18.12.0 - the
insertoption 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 (css, style) {
// Do something ...
style.innerHTML = `${css}.modify{}\n`;
document.head.appendChild(style);
},
},
},
"css-loader",
],
},
],
},
};After:
insert-function.js
function insert(css, style) {
const 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
styleTagTransformoption 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 (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",
],
},
],
},
};3.3.3 (2023-05-19)
3.3.2 (2023-03-13)
3.3.1 (2021-10-21)
3.3.0 (2021-09-21)
- added support for
supports(),layer()andmediafrom@importat-rules (b9a600c) - allow to pass options to
insertfunction throughstyle.use()(#535) (f8ef63b)
3.2.1 (2021-07-20)
3.2.0 (2021-07-20)
3.1.0 (2021-07-12)
- allow to specify the
insertoption from file, we strongly recommend do it, using theinsertoption from file will reduce your bundle size, example (#521) (56fc8f0) - allow to specify the
styleTagTransformoption from file, we strongly recommend do it, using thestyleTagTransformoption from file will reduce your bundle size, example
3.0.0 (2021-06-24)
- minimum supported
Node.jsversion is12.13.0 - minimum supported
webpackversion is5.0.0 - the
modules.namedExportoption was removed, you don't need it anymore, because we respect themodules.namedExportoption fromcss-loader(we just reexport all fromcss-loader), just remove it - the
styleTagvalue of theinjectType(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 settingautoStyleTagvalue for theinjectTypeoption (do the same forlazyStyleTag, i.e. change it tolazyAutoStyleTag)
- added
autoStyleTagandlazyAutoStyleTagvalues for theinjectTypeoption for compatibility of work modern and IE8-IE9 browsers - added
styleTagTransformoption 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)
- minimum supported
Node.jsversion is10.13.0 - the
esModuleoption istrueby default, you need to changeconst locals = require('./styles.css')/require('./styles.css')onimport locals from './styles.css'/import './styles.css''(#489) (727a24d) - removed support for loaders returning
Stringinstead ofArray(#491) (7a0ce4c)
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)
1.2.1 (2020-04-28)
1.2.0 (2020-04-24)
- hot module replacement for css modules (6d14e0a)
1.1.4 (2020-04-15)
- update deps
1.1.3 (2020-01-17)
1.1.2 (2019-12-25)
- algorithm for importing modules (#449) (91ceaf2)
- checking that the list of modules is an array (#448) (1138ed7)
1.1.1 (2019-12-20)
- add empty default export for
linkTagvalue (7ee8b04)
1.1.0 (2019-12-20)
1.0.2 (2019-12-17)
1.0.1 (2019-11-28)
1.0.0 (2019-08-06)
- es3 compatibility (#390) (ae24ec2)
- restore original hot reloading behaviour for locals (#419) (f026429)
- better handle source maps (#383) (84ec8e5)
- minimum required Node.js version is
8.9.0 - minimum required
wepbackversion is4.0.0 - the
convertToAbsoluteUrlsoption was removed, you don't need this anymore - the
attrsoption was renamed to theattributesoption - the
transformoption was removed without replacement - the
hmroption was removed,webpackautomatically inject HMR code when it is required (when theHotModuleReplacementPluginplugin was used) - the
sourceMapoption was removed. The loader automatically inject source maps if the previous loader emit them - the
ref/unrefapi methods were removed foruseableloader, please use theuse/unuseapi methods - the
style-loader/urlloader was removed in favorinjectTypeoption (look the documentation about theinjectTypeoption) - the
style-loader/useableloader was removed in favorinjectTypeoption (look the documentation about theinjectTypeoption) - the
singletonoption was removed (look documentation about theinjectTypeoption) - the
insertAtoption was removed in favor theinsertoption (look the documentation about theinsertoption and examples) - the
insertIntooptions was removed in favor theinsertoption (look the documentation about theinsertoption and examples)
0.23.1 (2018-10-08)
0.23.0 (2018-08-27)
0.22.1 (2018-08-08)
0.22.0 (2018-08-07)
0.21.0 (2018-04-18)
0.20.3 (2018-03-09)
0.20.2 (2018-02-15)
0.20.1 (2018-01-26)
0.20.0 (2018-01-26)
- addStyles: check if
HTMLIFrameElementexist (#296) (9b46128) - index: enable HMR in case
locals(css-modules) are unchanged (#298) (3a4cb53) - options: add
transformoption validation ({String}) (23c3567) - options: support passing a
{Function}(options.insertInto) (e0c4b19)
0.19.1 (2017-12-14)
0.19.0 (2017-10-03)
- 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)
- url: use
loaderUtils.stringifyRequestto avoid invalidating hashes due to absolute paths (#242) (97508ec) - Add
nullcheck toremoveStyleElement(#245) (0a4845c)
0.18.1 (2017-05-23)
0.18.0 (2017-05-22)
0.17.0 (2017-05-01)
0.16.1 (2017-03-28)
0.16.0 (2017-03-22)
0.15.0 (2017-03-21)
0.14.1 (2017-03-15)
0.14.0 (2017-03-15)
- 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)
- tag-attribute: Add support for custom tag attribute (995f3de)