Plugin Configs: Use nodes strip types for processing webpack configs (#105542)

* feat(plugin-configs): update configs to work with nodes strip-types feature

* build(parca): use nodes experimental-strip-types so build works with node 22 - 24

* build(decoupled-plugins): support nodes strip types feature for webpack builds

* build(e2e-test-plugins): update build scripts and config to work with node strip types

* style(plugin-configs): fix import/order lint errors

* refactor(plugins): use allowImportingTsExtensions in favour of ts-ignore comments

* refactor(plugin-configs): clean up ts-ignore and ts-expect-error comments in webpack.config

* refactor(plugin-configs): fix up changes for nodes strip-types flag

* chore(loki): fix up build command for node 24 support
pull/107881/head
Jack Westbrook 2 weeks ago committed by GitHub
parent 99f3dc859d
commit d786316766
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      .betterer.results
  2. 4
      e2e/test-plugins/grafana-extensionstest-app/package.json
  3. 4
      e2e/test-plugins/grafana-extensionstest-app/webpack.config.ts
  4. 4
      e2e/test-plugins/grafana-test-datasource/package.json
  5. 4
      e2e/test-plugins/grafana-test-datasource/webpack.config.ts
  6. 1
      packages/grafana-plugin-configs/package.json
  7. 14
      packages/grafana-plugin-configs/tsconfig.json
  8. 23
      packages/grafana-plugin-configs/types/replace-in-webpack-plugin.d.ts
  9. 11
      packages/grafana-plugin-configs/utils.ts
  10. 25
      packages/grafana-plugin-configs/webpack.config.ts
  11. 6
      public/app/plugins/datasource/azuremonitor/package.json
  12. 2
      public/app/plugins/datasource/azuremonitor/webpack.config.ts
  13. 6
      public/app/plugins/datasource/cloud-monitoring/package.json
  14. 3
      public/app/plugins/datasource/cloud-monitoring/webpack.config.ts
  15. 6
      public/app/plugins/datasource/grafana-postgresql-datasource/package.json
  16. 2
      public/app/plugins/datasource/grafana-postgresql-datasource/webpack.config.ts
  17. 6
      public/app/plugins/datasource/grafana-pyroscope-datasource/package.json
  18. 2
      public/app/plugins/datasource/grafana-pyroscope-datasource/webpack.config.ts
  19. 6
      public/app/plugins/datasource/grafana-testdata-datasource/package.json
  20. 3
      public/app/plugins/datasource/grafana-testdata-datasource/webpack.config.ts
  21. 6
      public/app/plugins/datasource/jaeger/package.json
  22. 6
      public/app/plugins/datasource/jaeger/webpack.config.ts
  23. 6
      public/app/plugins/datasource/loki/package.json
  24. 2
      public/app/plugins/datasource/loki/webpack.config.ts
  25. 6
      public/app/plugins/datasource/mssql/package.json
  26. 2
      public/app/plugins/datasource/mssql/webpack.config.ts
  27. 6
      public/app/plugins/datasource/mysql/package.json
  28. 2
      public/app/plugins/datasource/mysql/webpack.config.ts
  29. 6
      public/app/plugins/datasource/parca/package.json
  30. 2
      public/app/plugins/datasource/parca/webpack.config.ts
  31. 6
      public/app/plugins/datasource/tempo/package.json
  32. 3
      public/app/plugins/datasource/tempo/webpack.config.ts
  33. 6
      public/app/plugins/datasource/zipkin/package.json
  34. 3
      public/app/plugins/datasource/zipkin/webpack.config.ts

@ -3121,9 +3121,6 @@ exports[`better eslint`] = {
"public/app/plugins/datasource/cloud-monitoring/types/types.ts:5381": [ "public/app/plugins/datasource/cloud-monitoring/types/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
"public/app/plugins/datasource/cloud-monitoring/webpack.config.ts:5381": [
[0, 0, 0, "Do not re-export imported variable (\`config\`)", "0"]
],
"public/app/plugins/datasource/cloudwatch/components/ConfigEditor/ConfigEditor.tsx:5381": [ "public/app/plugins/datasource/cloudwatch/components/ConfigEditor/ConfigEditor.tsx:5381": [
[0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "0"], [0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "0"],
[0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "1"], [0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "1"],
@ -3290,9 +3287,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"] [0, 0, 0, "Unexpected any. Specify a different type.", "1"]
], ],
"public/app/plugins/datasource/grafana-testdata-datasource/webpack.config.ts:5381": [
[0, 0, 0, "Do not re-export imported variable (\`config\`)", "0"]
],
"public/app/plugins/datasource/grafana/components/AnnotationQueryEditor.tsx:5381": [ "public/app/plugins/datasource/grafana/components/AnnotationQueryEditor.tsx:5381": [
[0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "0"], [0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "0"],
[0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "1"], [0, 0, 0, "Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.", "1"],
@ -3644,9 +3638,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"] [0, 0, 0, "Unexpected any. Specify a different type.", "3"]
], ],
"public/app/plugins/datasource/tempo/webpack.config.ts:5381": [
[0, 0, 0, "Do not re-export imported variable (\`config\`)", "0"]
],
"public/app/plugins/datasource/zipkin/QueryField.tsx:5381": [ "public/app/plugins/datasource/zipkin/QueryField.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"] [0, 0, 0, "Unexpected any. Specify a different type.", "1"]
@ -3657,9 +3648,6 @@ exports[`better eslint`] = {
"public/app/plugins/datasource/zipkin/utils/transforms.ts:5381": [ "public/app/plugins/datasource/zipkin/utils/transforms.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
"public/app/plugins/datasource/zipkin/webpack.config.ts:5381": [
[0, 0, 0, "Do not re-export imported variable (\`config\`)", "0"]
],
"public/app/plugins/panel/annolist/AnnoListPanel.tsx:5381": [ "public/app/plugins/panel/annolist/AnnoListPanel.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"] [0, 0, 0, "Do not use any type assertions.", "0"]
], ],

@ -3,8 +3,8 @@
"version": "12.1.0-pre", "version": "12.1.0-pre",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"dev": "webpack -w -c ./webpack.config.ts --env development", "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ." "lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ."
}, },

@ -1,7 +1,7 @@
import CopyWebpackPlugin from 'copy-webpack-plugin'; import CopyWebpackPlugin from 'copy-webpack-plugin';
import grafanaConfig from '@grafana/plugin-configs/webpack.config'; import grafanaConfig from '@grafana/plugin-configs/webpack.config.ts';
import { mergeWithCustomize, unique } from 'webpack-merge'; import { mergeWithCustomize, unique } from 'webpack-merge';
import { Configuration } from 'webpack'; import { type Configuration } from 'webpack';
function skipFiles(f: string): boolean { function skipFiles(f: string): boolean {
if (f.includes('/dist/')) { if (f.includes('/dist/')) {

@ -3,8 +3,8 @@
"version": "12.1.0-pre", "version": "12.1.0-pre",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"dev": "webpack -w -c ./webpack.config.ts --env development", "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ." "lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ."
}, },

@ -1,7 +1,7 @@
import CopyWebpackPlugin from 'copy-webpack-plugin'; import CopyWebpackPlugin from 'copy-webpack-plugin';
import grafanaConfig from '@grafana/plugin-configs/webpack.config'; import grafanaConfig from '@grafana/plugin-configs/webpack.config.ts';
import { mergeWithCustomize, unique } from 'webpack-merge'; import { mergeWithCustomize, unique } from 'webpack-merge';
import { Configuration } from 'webpack'; import { type Configuration } from 'webpack';
function skipFiles(f: string): boolean { function skipFiles(f: string): boolean {
if (f.includes('/dist/')) { if (f.includes('/dist/')) {

@ -6,6 +6,7 @@
"dependencies": { "dependencies": {
"tslib": "2.8.1" "tslib": "2.8.1"
}, },
"type": "module",
"devDependencies": { "devDependencies": {
"@grafana/tsconfig": "^2.0.0", "@grafana/tsconfig": "^2.0.0",
"@swc/core": "1.10.12", "@swc/core": "1.10.12",

@ -4,19 +4,11 @@
"alwaysStrict": true, "alwaysStrict": true,
"declaration": false, "declaration": false,
"resolveJsonModule": true, "resolveJsonModule": true,
"moduleResolution": "bundler" "moduleResolution": "bundler",
}, "noEmit": true,
"ts-node": { "allowImportingTsExtensions": true
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"moduleResolution": "Node",
"esModuleInterop": true
},
"transpileOnly": true
}, },
"extends": "@grafana/tsconfig", "extends": "@grafana/tsconfig",
"exclude": ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"], "exclude": ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"],
"include": ["./types", "."] "include": ["./types", "."]
} }

@ -0,0 +1,23 @@
declare module 'replace-in-file-webpack-plugin' {
import { Compiler, Plugin } from 'webpack';
interface ReplaceRule {
search: string | RegExp;
replace: string | ((match: string) => string);
}
interface ReplaceOption {
dir?: string;
files?: string[];
test?: RegExp | RegExp[];
rules: ReplaceRule[];
}
class ReplaceInFilePlugin extends Plugin {
constructor(options?: ReplaceOption[]);
options: ReplaceOption[];
apply(compiler: Compiler): void;
}
export = ReplaceInFilePlugin;
}

@ -3,12 +3,19 @@ import { glob } from 'glob';
import path from 'path'; import path from 'path';
import process from 'process'; import process from 'process';
// Support for node 22 and 24. Due to the many changes in importing json files
// across recent node versions we load the json files using fs for simplicity.
function loadJson(path: string) {
const rawJson = fs.readFileSync(path, 'utf8');
return JSON.parse(rawJson);
}
export function getPackageJson() { export function getPackageJson() {
return require(path.resolve(process.cwd(), 'package.json')); return loadJson(path.resolve(process.cwd(), 'package.json'));
} }
export function getPluginJson() { export function getPluginJson() {
return require(path.resolve(process.cwd(), 'plugin.json')); return loadJson(path.resolve(process.cwd(), 'plugin.json'));
} }
export async function getEntries(): Promise<Record<string, string>> { export async function getEntries(): Promise<Record<string, string>> {

@ -2,15 +2,14 @@ import CopyWebpackPlugin from 'copy-webpack-plugin';
import ESLintPlugin from 'eslint-webpack-plugin'; import ESLintPlugin from 'eslint-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import path from 'path'; import path from 'path';
// @ts-expect-error - there are no types for this package
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin'; import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin'; import TerserPlugin from 'terser-webpack-plugin';
import { type Configuration, BannerPlugin } from 'webpack'; import webpack, { type Configuration } from 'webpack';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import VirtualModulesPlugin from 'webpack-virtual-modules'; import VirtualModulesPlugin from 'webpack-virtual-modules';
import { DIST_DIR } from './constants'; import { DIST_DIR } from './constants.ts';
import { getPackageJson, getPluginJson, getEntries, hasLicense } from './utils'; import { getPackageJson, getPluginJson, getEntries, hasLicense } from './utils.ts';
function skipFiles(f: string): boolean { function skipFiles(f: string): boolean {
if (f.includes('/dist/')) { if (f.includes('/dist/')) {
@ -54,9 +53,13 @@ const config = async (env: Env): Promise<Configuration> => {
cache: { cache: {
type: 'filesystem', type: 'filesystem',
buildDependencies: { buildDependencies: {
config: [__filename], config: [import.meta.filename],
}, },
cacheDirectory: path.resolve(__dirname, '../../node_modules/.cache/webpack', path.basename(process.cwd())), cacheDirectory: path.resolve(
import.meta.dirname,
'../../node_modules/.cache/webpack',
path.basename(process.cwd())
),
}, },
context: process.cwd(), context: process.cwd(),
@ -114,7 +117,7 @@ const config = async (env: Env): Promise<Configuration> => {
test: /module\.tsx?$/, test: /module\.tsx?$/,
use: [ use: [
{ {
loader: require.resolve('imports-loader'), loader: 'imports-loader',
options: { options: {
imports: `side-effects grafana-public-path`, imports: `side-effects grafana-public-path`,
}, },
@ -125,10 +128,10 @@ const config = async (env: Env): Promise<Configuration> => {
exclude: /(node_modules)/, exclude: /(node_modules)/,
test: /\.[tj]sx?$/, test: /\.[tj]sx?$/,
use: { use: {
loader: require.resolve('swc-loader'), loader: 'swc-loader',
options: { options: {
jsc: { jsc: {
baseUrl: path.resolve(__dirname), baseUrl: path.resolve(import.meta.dirname),
target: 'es2015', target: 'es2015',
loose: false, loose: false,
parser: { parser: {
@ -209,7 +212,7 @@ const config = async (env: Env): Promise<Configuration> => {
plugins: [ plugins: [
virtualPublicPath, virtualPublicPath,
// Insert create plugin version information into the bundle so Grafana will load from cdn with script tags. // Insert create plugin version information into the bundle so Grafana will load from cdn with script tags.
new BannerPlugin({ new webpack.BannerPlugin({
banner: '/* [create-plugin] version: 5.22.0 */', banner: '/* [create-plugin] version: 5.22.0 */',
raw: true, raw: true,
entryOnly: true, entryOnly: true,
@ -264,7 +267,7 @@ const config = async (env: Env): Promise<Configuration> => {
extensions: ['.ts', '.tsx'], extensions: ['.ts', '.tsx'],
lintDirtyModulesOnly: true, // don't lint on start, only lint changed files lintDirtyModulesOnly: true, // don't lint on start, only lint changed files
cacheLocation: path.resolve( cacheLocation: path.resolve(
__dirname, import.meta.dirname,
'../../node_modules/.cache/eslint-webpack-plugin', '../../node_modules/.cache/eslint-webpack-plugin',
path.basename(process.cwd()), path.basename(process.cwd()),
'.eslintcache' '.eslintcache'

@ -48,9 +48,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development", "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development",
"i18n-extract": "i18next --config locales/i18next-parser.config.cjs" "i18n-extract": "i18next --config locales/i18next-parser.config.cjs"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"

@ -1,7 +1,7 @@
import type { Configuration } from 'webpack'; import type { Configuration } from 'webpack';
import { merge } from 'webpack-merge'; import { merge } from 'webpack-merge';
import grafanaConfig from '@grafana/plugin-configs/webpack.config'; import grafanaConfig from '@grafana/plugin-configs/webpack.config.ts';
const config = async (env: Record<string, unknown>): Promise<Configuration> => { const config = async (env: Record<string, unknown>): Promise<Configuration> => {
const baseConfig = await grafanaConfig(env); const baseConfig = await grafanaConfig(env);

@ -48,9 +48,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,3 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
// eslint-disable-next-line no-barrel-files/no-barrel-files
export default config; export default config;

@ -33,9 +33,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,4 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
// eslint-disable-next-line no-barrel-files/no-barrel-files // eslint-disable-next-line no-barrel-files/no-barrel-files
export default config; export default config;

@ -42,9 +42,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,4 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
const configWithFallback = async (env: Record<string, unknown>) => { const configWithFallback = async (env: Record<string, unknown>) => {
const response = await config(env); const response = await config(env);

@ -41,9 +41,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,3 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
// eslint-disable-next-line no-barrel-files/no-barrel-files
export default config; export default config;

@ -44,9 +44,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,4 +1,8 @@
import config from '@grafana/plugin-configs/webpack.config'; import { createRequire } from 'node:module';
import config from '@grafana/plugin-configs/webpack.config.ts';
const require = createRequire(import.meta.url);
const configWithFallback = async (env: Record<string, unknown>) => { const configWithFallback = async (env: Record<string, unknown>) => {
const response = await config(env); const response = await config(env);

@ -44,9 +44,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,4 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
// eslint-disable-next-line no-barrel-files/no-barrel-files // eslint-disable-next-line no-barrel-files/no-barrel-files
export default config; export default config;

@ -35,9 +35,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development", "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development",
"i18n-extract": "i18next --config locales/i18next-parser.config.cjs" "i18n-extract": "i18next --config locales/i18next-parser.config.cjs"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"

@ -1,7 +1,7 @@
import type { Configuration } from 'webpack'; import type { Configuration } from 'webpack';
import { merge } from 'webpack-merge'; import { merge } from 'webpack-merge';
import grafanaConfig from '@grafana/plugin-configs/webpack.config'; import grafanaConfig from '@grafana/plugin-configs/webpack.config.ts';
const config = async (env: Record<string, unknown>): Promise<Configuration> => { const config = async (env: Record<string, unknown>): Promise<Configuration> => {
const baseConfig = await grafanaConfig(env); const baseConfig = await grafanaConfig(env);

@ -33,9 +33,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,4 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
// eslint-disable-next-line no-barrel-files/no-barrel-files // eslint-disable-next-line no-barrel-files/no-barrel-files
export default config; export default config;

@ -34,9 +34,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,3 +1,3 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
export default config; export default config;

@ -61,10 +61,10 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:stats": "yarn build --env stats --profile --json=compilation-stats.json", "build:stats": "yarn build --env stats --profile --json=compilation-stats.json",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,3 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
// eslint-disable-next-line no-barrel-files/no-barrel-files
export default config; export default config;

@ -37,9 +37,9 @@
"@grafana/runtime": "*" "@grafana/runtime": "*"
}, },
"scripts": { "scripts": {
"build": "webpack -c ./webpack.config.ts --env production", "build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", "build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "webpack -w -c ./webpack.config.ts --env development" "dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
}, },
"packageManager": "yarn@4.9.2" "packageManager": "yarn@4.9.2"
} }

@ -1,3 +1,4 @@
import config from '@grafana/plugin-configs/webpack.config'; import config from '@grafana/plugin-configs/webpack.config.ts';
// eslint-disable-next-line no-barrel-files/no-barrel-files
export default config; export default config;

Loading…
Cancel
Save