Skip to content

Commit b5b9144

Browse files
committedMar 4, 2021
Remove webpack 1 support
1 parent 8c29934 commit b5b9144

File tree

2 files changed

+0
-80
lines changed

2 files changed

+0
-80
lines changed
 

‎README.md

-64
Original file line numberDiff line numberDiff line change
@@ -83,67 +83,3 @@ plugins:
8383
```
8484
8585
You can use `YML` or `JSON` files as external configs.
86-
87-
### Legacy Webpack v1 config
88-
89-
There are two ways of loading svgo configuration.
90-
You can pass it as a JSON string after loader name, like this:
91-
92-
``` javascript
93-
// webpack.config.js
94-
95-
var svgoConfig = JSON.stringify({
96-
plugins: [
97-
{removeTitle: true},
98-
{convertColors: {shorthex: false}},
99-
{convertPathData: false}
100-
]
101-
});
102-
103-
module.exports = {
104-
...
105-
module: {
106-
loaders: [
107-
{
108-
test: /.*\.svg$/,
109-
loaders: [
110-
'file-loader',
111-
'svgo-loader?' + svgoConfig
112-
]
113-
}
114-
]
115-
}
116-
}
117-
```
118-
119-
Or you can save svgo config in your main webpack config object,
120-
and then specify name of the property in the loader query string.
121-
122-
However, this option will not work in Webpack 2.<br>
123-
This is only shown here in the documentation for backwards compatibility.
124-
125-
``` javascript
126-
// webpack.config.js
127-
128-
module.exports = {
129-
...
130-
module: {
131-
loaders: [
132-
{
133-
test: /.*\.svg$/,
134-
loaders: [
135-
'file-loader',
136-
'svgo-loader?useConfig=svgoConfig1'
137-
]
138-
}
139-
]
140-
},
141-
svgoConfig1: {
142-
plugins: [
143-
{removeTitle: true},
144-
{convertColors: {shorthex: false}},
145-
{convertPathData: false}
146-
]
147-
}
148-
}
149-
```

‎index.js

-16
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@ module.exports = function(source) {
1010

1111
var config = loaderUtils.getOptions(this) || {};
1212

13-
// This piece of code exists in order to support webpack 1.x.x top level configurations.
14-
// In webpack 2 this options does not exists anymore.
15-
// Please use the `options` field of the loader to pass your configuration
16-
if (config.useConfig) {
17-
var configName = config.useConfig;
18-
var config = this.options[configName];
19-
if (config === undefined) {
20-
callback(new Error(
21-
'You specified "useConfig=' + configName +
22-
'" for svgo-loader, but there is no property named "' + configName +
23-
'" in your main webpack configuration.'
24-
));
25-
return;
26-
}
27-
}
28-
2913
// Ported from:
3014
// https://github.com/svg/svgo/blob/174c37208017e5909d5f7db2e8faba49663a945a/lib/svgo/coa.js#L175-L192
3115
if (typeof config.externalConfig === 'string') {

0 commit comments

Comments
 (0)
Please sign in to comment.