Chore: Switch yarn 2 to plug-n-play strategy (#40300)

This commit is contained in:
kay delaney
2021-10-27 14:21:07 +01:00
committed by GitHub
parent 690849cfd6
commit 3a7c5a0755
65 changed files with 3122 additions and 1393 deletions

View File

@ -10,7 +10,10 @@ class CopyUniconsPlugin {
let destDir = path.resolve(__dirname, '../../public/img/icons/unicons');
if (!fs.pathExistsSync(destDir)) {
let srcDir = path.resolve(__dirname, '../../node_modules/iconscout-unicons-tarball/unicons/svg/line');
let srcDir = path.join(
path.dirname(require.resolve('iconscout-unicons-tarball/package.json')),
'unicons/svg/line'
);
fs.copySync(srcDir, destDir);
}
});
@ -32,27 +35,19 @@ module.exports = {
resolve: {
extensions: ['.ts', '.tsx', '.es6', '.js', '.json', '.svg'],
alias: {
// rc-trigger uses babel-runtime which has internal dependency to core-js@2
// this alias maps that dependency to core-js@t3
'core-js/library/fn': 'core-js/stable',
// storybook v6 bump caused the app to bundle multiple versions of react breaking hooks
// make sure to resolve only from the project: https://github.com/facebook/react/issues/13991#issuecomment-435587809
react: path.resolve(__dirname, '../../node_modules/react'),
// Needed as these don't work across different execution contexts, which can cause
// problems with @grafana/ui
'react-router': require.resolve('react-router'),
'react-router-dom': require.resolve('react-router-dom'),
'react-hook-form': require.resolve('react-hook-form'),
jquery: require.resolve('jquery'),
// some of data source pluginis use global Prism object to add the language definition
// we want to have same Prism object in core and in grafana/ui
prismjs: path.resolve(__dirname, '../../node_modules/prismjs'),
prismjs: require.resolve('prismjs'),
},
modules: [
'node_modules',
path.resolve('public'),
// we need full path to root node_modules for grafana-enterprise symlink to work
path.resolve('node_modules'),
'.yarn',
path.resolve('.yarn'),
path.resolve('public'),
],
fallback: {
buffer: false,
@ -60,6 +55,7 @@ module.exports = {
stream: false,
http: false,
https: false,
string_decoder: false,
},
},
ignoreWarnings: [/export .* was not found in/],
@ -75,9 +71,9 @@ module.exports = {
new CopyWebpackPlugin({
patterns: [
{
context: path.resolve(__dirname, '../../node_modules/monaco-editor/'),
from: 'min/vs/**',
to: '../lib/monaco/', // inside the public/build folder
context: path.join(require.resolve('monaco-editor/package.json'), '../min/vs/'),
from: '**/*',
to: '../lib/monaco/min/vs/', // inside the public/build folder
globOptions: {
ignore: [
'**/*.map', // debug files
@ -85,7 +81,8 @@ module.exports = {
},
},
{
from: './node_modules/@kusto/monaco-kusto/release/min/',
context: path.join(require.resolve('@kusto/monaco-kusto'), '../'),
from: '**/*',
to: '../lib/monaco/min/vs/language/kusto/',
},
],