We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 659fe80 commit b53fa56Copy full SHA for b53fa56
src/index.js
@@ -10,9 +10,20 @@ const buildSvg = template(`
10
var SVG_NAME = function SVG_NAME(props) { return SVG_CODE; };
11
`);
12
13
+let ignoreRegex;
14
+
15
export default ({ types: t }) => ({
16
visitor: {
17
ImportDeclaration(path, state) {
18
+ const { ignorePattern } = state.opts;
19
+ if (ignorePattern) {
20
+ // Only set the ignoreRegex once:
21
+ ignoreRegex = ignoreRegex || new RegExp(ignorePattern);
22
+ // Test if we should ignore this:
23
+ if (ignoreRegex.test(path.node.source.value)) {
24
+ return;
25
+ }
26
27
// This plugin only applies for SVGs:
28
if (extname(path.node.source.value) === '.svg') {
29
// We only support the import default specifier, so let's use that identifier:
0 commit comments