diff --git a/packages/grafana-toolkit/src/config/webpack.plugin.config.ts b/packages/grafana-toolkit/src/config/webpack.plugin.config.ts index 9d8602dd948..cb88145aa43 100644 --- a/packages/grafana-toolkit/src/config/webpack.plugin.config.ts +++ b/packages/grafana-toolkit/src/config/webpack.plugin.config.ts @@ -82,6 +82,7 @@ const getEntries = async () => { }; const getCommonPlugins = (options: WebpackConfigurationOptions) => { + const hasREADME = fs.existsSync(path.resolve(process.cwd(), 'src', 'README.md')); const packageJson = require(path.resolve(process.cwd(), 'package.json')); return [ new MiniCssExtractPlugin({ @@ -91,8 +92,9 @@ const getCommonPlugins = (options: WebpackConfigurationOptions) => { new webpack.optimize.OccurrenceOrderPlugin(true), new CopyWebpackPlugin( [ + // If src/README.md exists use it; otherwise the root README + { from: hasREADME ? 'README.md' : '../README.md', to: '.', force: true }, { from: 'plugin.json', to: '.' }, - { from: '../README.md', to: '.' }, { from: '../LICENSE', to: '.' }, { from: '**/*.json', to: '.' }, { from: '**/*.svg', to: '.' },