In my Vue project created with Vue cli 3, I am utilizing Snap.svg. To integrate Snap into the project, I added the following configuration to vue.config.js:
module.exports = {
chainWebpack: config => {
config.module
.rule("i18n")
.resourceQuery(/blockType=i18n/)
.type("javascript/auto")
.use("i18n")
.loader("@kazupon/vue-i18n-loader")
.end();
config.module
.rule("snapsvg")
.test(require.resolve("snapsvg"))
.use("imports-loader?this=>window,fix=>module.exports=0")
.loader("imports-loader")
.end();
}
};
I also included Snap in main.js like this:
const snap = require(`imports-loader?this=>window,fix=>module.exports=0!snapsvg/dist/snap.svg.js`);
Within my components, I am using Snap without local import as shown below:
var s = Snap(this.paper["svg-wrap"]);
The library functions correctly and generates SVG elements, however, Eslint errors are persisting.
error: 'Snap' is not defined (no-undef) at src\components\subpageBanner.vue:246:21:
I would like to continue using Eslint in all components but configure it to ignore these types of errors. Is there a way to achieve this?