diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-03-21 00:58:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-21 00:58:58 +0300 |
commit | be9769fbb74772ecbfb396d25d8cfa2bcea63822 (patch) | |
tree | f72f7d78391cb639dc9ca668799d115bcb056ad1 | |
parent | 196ed2e338a236c210543fa73016e7d29991549b (diff) |
only write vue metadata JSON file if there is a src file in the vue plugin (#18973)
-rw-r--r-- | vue.config.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/vue.config.js b/vue.config.js index 3077d83415..2ec902126e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -23,6 +23,7 @@ if (!process.env.MATOMO_CURRENT_PLUGIN) { console.log("The MATOMO_CURRENT_PLUGIN environment variable is not set!"); } +const srcPath = `plugins/${process.env.MATOMO_CURRENT_PLUGIN}/vue/src/`; const publicPath = `plugins/${process.env.MATOMO_CURRENT_PLUGIN}/vue/dist/`; // hack to get publicPath working for lib build target (see https://github.com/vuejs/vue-cli/issues/4896#issuecomment-569001811) @@ -54,8 +55,10 @@ OutputDetectedDependentPluginsPlugin.prototype.apply = function (compiler) { const metadata = { dependsOn: detectedDependentPlugins, }; - fs.mkdirSync(path.dirname(metadataPath), { recursive: true }); - fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2)); + if (fs.existsSync(path.join(srcPath))) { + fs.mkdirSync(path.dirname(metadataPath), {recursive: true}); + fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2)); + } }); }; |