svgo-loader
Advanced tools
Comparing version 3.0.3 to 4.0.0
@@ -7,3 +7,4 @@ module.exports = { | ||
path: __dirname + "/dist", | ||
filename: "bundle.js" | ||
filename: "bundle.js", | ||
assetModuleFilename: '[name][ext]' | ||
}, | ||
@@ -14,10 +15,4 @@ module: { | ||
test: /\.svg$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader' | ||
}, | ||
{ | ||
loader: '../../index.js', | ||
} | ||
] | ||
type: 'asset/resource', | ||
loader: '../../index.js', | ||
} | ||
@@ -24,0 +19,0 @@ ] |
@@ -7,3 +7,4 @@ module.exports = { | ||
path: __dirname + "/dist", | ||
filename: "bundle.js" | ||
filename: "bundle.js", | ||
assetModuleFilename: "[name][ext]" | ||
}, | ||
@@ -14,13 +15,7 @@ module: { | ||
test: /\.svg$/, | ||
use: [ | ||
{ | ||
loader: "file-loader" | ||
}, | ||
{ | ||
loader: "../../index.js", | ||
options: { | ||
configFile: './svgo.config.js' | ||
} | ||
} | ||
] | ||
type: "asset/resource", | ||
loader: "../../index.js", | ||
options: { | ||
configFile: './svgo.config.js' | ||
} | ||
} | ||
@@ -27,0 +22,0 @@ ] |
@@ -7,3 +7,4 @@ module.exports = { | ||
path: __dirname + "/dist", | ||
filename: "bundle.js" | ||
filename: "bundle.js", | ||
assetModuleFilename: "[name][ext]" | ||
}, | ||
@@ -14,10 +15,4 @@ module: { | ||
test: /\.svg$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader' | ||
}, | ||
{ | ||
loader: '../../index.js', | ||
} | ||
] | ||
type: 'asset/resource', | ||
loader: '../../index.js' | ||
} | ||
@@ -24,0 +19,0 @@ ] |
const { optimize, loadConfig } = require('svgo'); | ||
const loaderUtils = require('loader-utils'); | ||
async function loader(source) { | ||
const { configFile, ...options } = loaderUtils.getOptions(this) || {}; | ||
const { configFile, ...options } = this.getOptions(); | ||
let config; | ||
@@ -13,5 +12,2 @@ if (typeof configFile === 'string') { | ||
const result = optimize(source, { path: this.resourcePath, ...config, ...options }); | ||
if (result.error) { | ||
throw Error(result.error); | ||
} | ||
return result.data; | ||
@@ -18,0 +14,0 @@ } |
{ | ||
"name": "svgo-loader", | ||
"version": "3.0.3", | ||
"version": "4.0.0", | ||
"description": "svgo loader for webpack", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node --test" | ||
}, | ||
@@ -24,10 +24,8 @@ "repository": { | ||
"devDependencies": { | ||
"file-loader": "^2.0.0", | ||
"webpack": "^4.17.2", | ||
"webpack-cli": "^3.1.0" | ||
"webpack": "^5.0.0", | ||
"webpack-cli": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"loader-utils": "^2.0.3", | ||
"svgo": "^2.8.0" | ||
"svgo": "^3.0.0" | ||
} | ||
} |
@@ -26,10 +26,4 @@ # [svgo](https://github.com/svg/svgo) loader for [webpack](https://github.com/webpack/webpack) | ||
test: /\.svg$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader' | ||
}, | ||
{ | ||
loader: 'svgo-loader', | ||
} | ||
] | ||
type: 'asset', | ||
loader: 'svgo-loader' | ||
} | ||
@@ -53,13 +47,7 @@ ] | ||
test: /\.svg$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader' | ||
}, | ||
{ | ||
loader: 'svgo-loader', | ||
options: { | ||
configFile: './scripts/svgo.config.js' | ||
} | ||
} | ||
] | ||
type: 'asset', | ||
loader: 'svgo-loader', | ||
options: { | ||
configFile: './scripts/svgo.config.js' | ||
} | ||
} | ||
@@ -80,13 +68,7 @@ ] | ||
test: /\.svg$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader' | ||
}, | ||
{ | ||
loader: 'svgo-loader', | ||
options: { | ||
configFile: false | ||
} | ||
} | ||
] | ||
type: 'asset', | ||
loader: 'svgo-loader', | ||
options: { | ||
configFile: false | ||
} | ||
} | ||
@@ -107,17 +89,11 @@ ] | ||
test: /\.svg$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader' | ||
}, | ||
{ | ||
loader: 'svgo-loader', | ||
options: { | ||
multipass: true, | ||
js2svg: { | ||
indent: 2, | ||
pretty: true, | ||
} | ||
} | ||
type: 'asset', | ||
loader: 'svgo-loader', | ||
options: { | ||
multipass: true, | ||
js2svg: { | ||
indent: 2, | ||
pretty: true, | ||
} | ||
] | ||
} | ||
} | ||
@@ -124,0 +100,0 @@ ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
34033
1
2
17
161
0
104
2
+ Addedcss-select@5.1.0(transitive)
+ Addedcss-tree@2.2.12.3.1(transitive)
+ Addedcsso@5.0.5(transitive)
+ Addeddom-serializer@2.0.0(transitive)
+ Addeddomhandler@5.0.3(transitive)
+ Addeddomutils@3.1.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedmdn-data@2.0.282.0.30(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedsvgo@3.3.2(transitive)
- Removedloader-utils@^2.0.3
- Removedbig.js@5.2.2(transitive)
- Removedcss-select@4.3.0(transitive)
- Removedcss-tree@1.1.3(transitive)
- Removedcsso@4.2.0(transitive)
- Removeddom-serializer@1.4.1(transitive)
- Removeddomhandler@4.3.1(transitive)
- Removeddomutils@2.8.0(transitive)
- Removedemojis-list@3.0.0(transitive)
- Removedentities@2.2.0(transitive)
- Removedjson5@2.2.3(transitive)
- Removedloader-utils@2.0.4(transitive)
- Removedmdn-data@2.0.14(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedstable@0.1.8(transitive)
- Removedsvgo@2.8.0(transitive)
Updatedsvgo@^3.0.0