Skip to content

Commit fb00715

Browse files
committed
fix: don't merge imports
revert: #274
1 parent c52e244 commit fb00715

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

packages/babel-plugin-jsx/src/index.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -191,44 +191,6 @@ export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
191191
}
192192
}
193193
},
194-
exit(path) {
195-
const body = path.get('body') as NodePath[];
196-
const specifiersMap = new Map<string, t.ImportSpecifier>();
197-
198-
body
199-
.filter(
200-
(nodePath) =>
201-
t.isImportDeclaration(nodePath.node) &&
202-
nodePath.node.source.value === 'vue'
203-
)
204-
.forEach((nodePath) => {
205-
const { specifiers } = nodePath.node as t.ImportDeclaration;
206-
let shouldRemove = false;
207-
specifiers.forEach((specifier) => {
208-
if (
209-
!specifier.loc &&
210-
t.isImportSpecifier(specifier) &&
211-
t.isIdentifier(specifier.imported)
212-
) {
213-
specifiersMap.set(specifier.imported.name, specifier);
214-
shouldRemove = true;
215-
}
216-
});
217-
if (shouldRemove) {
218-
nodePath.remove();
219-
}
220-
});
221-
222-
const specifiers = [...specifiersMap.keys()].map(
223-
(imported) => specifiersMap.get(imported)!
224-
);
225-
if (specifiers.length) {
226-
path.unshiftContainer(
227-
'body',
228-
t.importDeclaration(specifiers, t.stringLiteral('vue'))
229-
);
230-
}
231-
},
232194
},
233195
},
234196
};

0 commit comments

Comments
 (0)