diff --git a/e2e/test-plugins/grafana-extensionstest-app/package.json b/e2e/test-plugins/grafana-extensionstest-app/package.json index 0bef81cbf48..df7d39010d0 100644 --- a/e2e/test-plugins/grafana-extensionstest-app/package.json +++ b/e2e/test-plugins/grafana-extensionstest-app/package.json @@ -3,8 +3,8 @@ "version": "11.6.0-pre", "private": true, "scripts": { - "build": "webpack -c ./webpack.config.ts --env production", - "dev": "webpack -w -c ./webpack.config.ts --env development", + "build": "rspack -c ./rspack.config.ts --env production", + "dev": "rspack -w -c ./rspack.config.ts --env development", "typecheck": "tsc --noEmit", "lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ." }, @@ -12,6 +12,7 @@ "license": "Apache-2.0", "devDependencies": { "@grafana/plugin-configs": "workspace:*", + "@rspack/cli": "^1.0.0", "@types/lodash": "4.17.7", "@types/node": "22.10.2", "@types/prismjs": "1.26.4", @@ -22,7 +23,6 @@ "glob": "10.4.1", "ts-node": "10.9.2", "typescript": "5.5.4", - "webpack": "5.95.0", "webpack-merge": "5.10.0" }, "engines": { diff --git a/e2e/test-plugins/grafana-extensionstest-app/rspack.config.ts b/e2e/test-plugins/grafana-extensionstest-app/rspack.config.ts new file mode 100644 index 00000000000..baeef5be31e --- /dev/null +++ b/e2e/test-plugins/grafana-extensionstest-app/rspack.config.ts @@ -0,0 +1,36 @@ +import rspack from '@rspack/core'; +import grafanaConfig from '@grafana/plugin-configs/rspack.config'; +import { mergeWithCustomize, unique } from 'webpack-merge'; +import { Configuration } from 'webpack'; + +const config = async (env: Record): Promise => { + const baseConfig = await grafanaConfig(env); + const customConfig = { + plugins: [ + new rspack.CopyRspackPlugin({ + patterns: [ + // To `compiler.options.output` + { from: 'README.md', to: '.', force: true }, + { from: 'plugin.json', to: '.' }, + { from: 'CHANGELOG.md', to: '.', force: true }, + { + from: '**/*.json', + to: '.', + globOptions: { ignore: ['**/dist/**', '**/tsconfig.json', '**/package.json', '**/project.json'] }, + }, + { from: '**/*.svg', to: '.', noErrorOnMissing: true, globOptions: { ignore: ['**/dist/**'] } }, // Optional + ], + }), + ], + }; + + return mergeWithCustomize({ + customizeArray: unique( + 'plugins', + [rspack.CopyRspackPlugin.name], + (plugin) => plugin.constructor && plugin.constructor.name + ), + })(baseConfig, customConfig); +}; + +export default config; diff --git a/e2e/test-plugins/grafana-extensionstest-app/webpack.config.ts b/e2e/test-plugins/grafana-extensionstest-app/webpack.config.ts deleted file mode 100644 index 3303ed94f3c..00000000000 --- a/e2e/test-plugins/grafana-extensionstest-app/webpack.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import CopyWebpackPlugin from 'copy-webpack-plugin'; -import grafanaConfig from '@grafana/plugin-configs/webpack.config'; -import { mergeWithCustomize, unique } from 'webpack-merge'; -import { Configuration } from 'webpack'; - -function skipFiles(f: string): boolean { - if (f.includes('/dist/')) { - // avoid copying files already in dist - return false; - } - if (f.includes('/node_modules/')) { - // avoid copying tsconfig.json - return false; - } - if (f.includes('/package.json')) { - // avoid copying package.json - return false; - } - return true; -} - -const config = async (env: Record): Promise => { - const baseConfig = await grafanaConfig(env); - const customConfig = { - plugins: [ - new CopyWebpackPlugin({ - patterns: [ - // To `compiler.options.output` - { from: 'README.md', to: '.', force: true }, - { from: 'plugin.json', to: '.' }, - { from: 'CHANGELOG.md', to: '.', force: true }, - { from: '**/*.json', to: '.', filter: skipFiles }, - { from: '**/*.svg', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional - ], - }), - ], - }; - - return mergeWithCustomize({ - customizeArray: unique('plugins', ['CopyPlugin'], (plugin) => plugin.constructor && plugin.constructor.name), - })(baseConfig, customConfig); -}; - -export default config; diff --git a/e2e/test-plugins/grafana-test-datasource/package.json b/e2e/test-plugins/grafana-test-datasource/package.json index e4472e7a923..b5304c2e642 100644 --- a/e2e/test-plugins/grafana-test-datasource/package.json +++ b/e2e/test-plugins/grafana-test-datasource/package.json @@ -3,8 +3,8 @@ "version": "11.6.0-pre", "private": true, "scripts": { - "build": "webpack -c ./webpack.config.ts --env production", - "dev": "webpack -w -c ./webpack.config.ts --env development", + "build": "rspack -c ./rspack.config.ts --env production", + "dev": "rspack -w -c ./rspack.config.ts --env development", "typecheck": "tsc --noEmit", "lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ." }, @@ -12,6 +12,7 @@ "license": "Apache-2.0", "devDependencies": { "@grafana/plugin-configs": "workspace:*", + "@rspack/cli": "^1.0.0", "@types/lodash": "4.17.7", "@types/node": "22.10.2", "@types/prismjs": "1.26.4", @@ -22,7 +23,6 @@ "glob": "10.4.1", "ts-node": "10.9.2", "typescript": "5.5.4", - "webpack": "5.95.0", "webpack-merge": "5.10.0" }, "engines": { diff --git a/e2e/test-plugins/grafana-test-datasource/rspack.config.ts b/e2e/test-plugins/grafana-test-datasource/rspack.config.ts new file mode 100644 index 00000000000..baeef5be31e --- /dev/null +++ b/e2e/test-plugins/grafana-test-datasource/rspack.config.ts @@ -0,0 +1,36 @@ +import rspack from '@rspack/core'; +import grafanaConfig from '@grafana/plugin-configs/rspack.config'; +import { mergeWithCustomize, unique } from 'webpack-merge'; +import { Configuration } from 'webpack'; + +const config = async (env: Record): Promise => { + const baseConfig = await grafanaConfig(env); + const customConfig = { + plugins: [ + new rspack.CopyRspackPlugin({ + patterns: [ + // To `compiler.options.output` + { from: 'README.md', to: '.', force: true }, + { from: 'plugin.json', to: '.' }, + { from: 'CHANGELOG.md', to: '.', force: true }, + { + from: '**/*.json', + to: '.', + globOptions: { ignore: ['**/dist/**', '**/tsconfig.json', '**/package.json', '**/project.json'] }, + }, + { from: '**/*.svg', to: '.', noErrorOnMissing: true, globOptions: { ignore: ['**/dist/**'] } }, // Optional + ], + }), + ], + }; + + return mergeWithCustomize({ + customizeArray: unique( + 'plugins', + [rspack.CopyRspackPlugin.name], + (plugin) => plugin.constructor && plugin.constructor.name + ), + })(baseConfig, customConfig); +}; + +export default config; diff --git a/e2e/test-plugins/grafana-test-datasource/webpack.config.ts b/e2e/test-plugins/grafana-test-datasource/webpack.config.ts deleted file mode 100644 index 3303ed94f3c..00000000000 --- a/e2e/test-plugins/grafana-test-datasource/webpack.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import CopyWebpackPlugin from 'copy-webpack-plugin'; -import grafanaConfig from '@grafana/plugin-configs/webpack.config'; -import { mergeWithCustomize, unique } from 'webpack-merge'; -import { Configuration } from 'webpack'; - -function skipFiles(f: string): boolean { - if (f.includes('/dist/')) { - // avoid copying files already in dist - return false; - } - if (f.includes('/node_modules/')) { - // avoid copying tsconfig.json - return false; - } - if (f.includes('/package.json')) { - // avoid copying package.json - return false; - } - return true; -} - -const config = async (env: Record): Promise => { - const baseConfig = await grafanaConfig(env); - const customConfig = { - plugins: [ - new CopyWebpackPlugin({ - patterns: [ - // To `compiler.options.output` - { from: 'README.md', to: '.', force: true }, - { from: 'plugin.json', to: '.' }, - { from: 'CHANGELOG.md', to: '.', force: true }, - { from: '**/*.json', to: '.', filter: skipFiles }, - { from: '**/*.svg', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional - ], - }), - ], - }; - - return mergeWithCustomize({ - customizeArray: unique('plugins', ['CopyPlugin'], (plugin) => plugin.constructor && plugin.constructor.name), - })(baseConfig, customConfig); -}; - -export default config; diff --git a/yarn.lock b/yarn.lock index 7e8cdd7b4ad..997df39c9a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9431,6 +9431,7 @@ __metadata: "@grafana/runtime": "workspace:*" "@grafana/schema": "workspace:*" "@grafana/ui": "workspace:*" + "@rspack/cli": "npm:^1.0.0" "@types/lodash": "npm:4.17.7" "@types/node": "npm:22.10.2" "@types/prismjs": "npm:1.26.4" @@ -9446,7 +9447,6 @@ __metadata: ts-node: "npm:10.9.2" tslib: "npm:2.6.3" typescript: "npm:5.5.4" - webpack: "npm:5.95.0" webpack-merge: "npm:5.10.0" peerDependencies: "@grafana/runtime": "*" @@ -9463,6 +9463,7 @@ __metadata: "@grafana/runtime": "workspace:*" "@grafana/schema": "workspace:*" "@grafana/ui": "workspace:*" + "@rspack/cli": "npm:^1.0.0" "@types/lodash": "npm:4.17.7" "@types/node": "npm:22.10.2" "@types/prismjs": "npm:1.26.4" @@ -9478,7 +9479,6 @@ __metadata: ts-node: "npm:10.9.2" tslib: "npm:2.6.3" typescript: "npm:5.5.4" - webpack: "npm:5.95.0" webpack-merge: "npm:5.10.0" peerDependencies: "@grafana/runtime": "*"