Replace vue-svg-loader dependency with simple JS file (fixes a security alert) (#389)
This commit is contained in:
parent
330697bb98
commit
3c29633745
File diff suppressed because it is too large
Load Diff
|
|
@ -40,7 +40,6 @@
|
||||||
"sass-loader": "^8.0.2",
|
"sass-loader": "^8.0.2",
|
||||||
"typescript": "^4.4.2",
|
"typescript": "^4.4.2",
|
||||||
"vue-loader": "^16.5.0",
|
"vue-loader": "^16.5.0",
|
||||||
"vue-svg-loader": "^0.17.0-beta.2",
|
|
||||||
"vue-template-compiler": "^2.6.14",
|
"vue-template-compiler": "^2.6.14",
|
||||||
"wasm-pack": "^0.10.1"
|
"wasm-pack": "^0.10.1"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
export function download(filename: string, fileData: string) {
|
export function download(filename: string, fileData: string) {
|
||||||
let type = "text/plain;charset=utf-8";
|
const type = filename.endsWith(".svg") ? "image/svg+xml;charset=utf-8" : "text/plain;charset=utf-8";
|
||||||
if (filename.endsWith(".svg")) {
|
|
||||||
type = "image/svg+xml;charset=utf-8";
|
|
||||||
}
|
|
||||||
const blob = new Blob([fileData], { type });
|
const blob = new Blob([fileData], { type });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
const element = document.createElement("a");
|
const element = document.createElement("a");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = function VueSvgLoader(svg) {
|
||||||
|
this.cacheable();
|
||||||
|
return `<template>${svg}</template>`;
|
||||||
|
};
|
||||||
|
|
@ -78,20 +78,22 @@ module.exports = {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Vue SVG Loader enables importing .svg files into .vue single-file components and using them directly in the HTML
|
// Change the loaders used by the Vue compilation process
|
||||||
// https://vue-svg-loader.js.org/
|
|
||||||
config.module
|
config.module
|
||||||
// Replace Vue's existing base loader by first clearing it (https://cli.vuejs.org/guide/webpack.html#replacing-loaders-of-a-rule)
|
// Replace Vue's existing base loader by first clearing it
|
||||||
|
// https://cli.vuejs.org/guide/webpack.html#replacing-loaders-of-a-rule
|
||||||
.rule("svg")
|
.rule("svg")
|
||||||
.uses.clear()
|
.uses.clear()
|
||||||
.end()
|
.end()
|
||||||
// Add vue-loader as a loader
|
// Add vue-loader as a loader for Vue single-file components
|
||||||
|
// https://www.npmjs.com/package/vue-loader
|
||||||
.use("vue-loader")
|
.use("vue-loader")
|
||||||
.loader("vue-loader")
|
.loader("vue-loader")
|
||||||
.end()
|
.end()
|
||||||
// Add vue-svg-loader as a loader
|
// Add vue-svg-loader as a loader for importing .svg files into Vue single-file components
|
||||||
.use("vue-svg-loader")
|
// Located in ./vue-svg-loader.js
|
||||||
.loader("vue-svg-loader")
|
.use("./vue-svg-loader")
|
||||||
|
.loader("./vue-svg-loader")
|
||||||
.end();
|
.end();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue