Skip to content

Commit 045ce1a

Browse files
committed
FIx vue cli babel generation
1 parent ebaa5e8 commit 045ce1a

File tree

1 file changed

+24
-0
lines changed
  • packages/common/templates/configuration/babelrc

1 file changed

+24
-0
lines changed

packages/common/templates/configuration/babelrc/index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ const config: ConfigurationFile = {
4040
}
4141

4242
if (template === 'vue-cli') {
43+
// TODO remove this
44+
/**
45+
* This hacky fix got added for vue cli templates that are v3, but don't have a config.
46+
*
47+
* We correctly detect v3 templates, so start using babel 7, but they don't work with the old version of babel config. We need to create a new one.
48+
*
49+
* Need to fix this ASAP and make vue-cli 3 a separate template.
50+
*/
51+
try {
52+
const packageJSON = resolveModule('/package.json');
53+
const parsed = JSON.parse(packageJSON.code);
54+
55+
if (
56+
parsed.devDependencies &&
57+
parsed.devDependencies['@vue/cli-plugin-babel']
58+
) {
59+
return JSON.stringify({
60+
presets: ['@vue/app'],
61+
});
62+
}
63+
} catch (e) {
64+
console.error(e);
65+
}
66+
4367
return JSON.stringify(
4468
{
4569
presets: [

0 commit comments

Comments
 (0)