Skip to content

Commit

Permalink
feat: 监控trace datasource插件开发
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 25736
  • Loading branch information
liangling0628 committed Dec 3, 2024
1 parent 1bbc3c9 commit e7ba861
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG NODE_IMAGE=node:20.11.1-slim
ARG PNPM_VERSION=9
ARG NODE_IMAGE=node:20
ARG PNPM_VERSION=9.12.3
ARG NODE_PLATFORM=linux/amd64

FROM --platform=${NODE_PLATFORM} ${NODE_IMAGE} as nodejs
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@types/react-dom": "18.3.1",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"buffer": "^6.0.3",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"eslint-plugin-react": "^7.37.2",
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions src/trace/.config/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import CopyWebpackPlugin from 'copy-webpack-plugin';
import LiveReloadPlugin from 'webpack-livereload-plugin';
import path from 'node:path';
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
import type { Configuration } from 'webpack';
import { type Configuration, ProvidePlugin } from 'webpack';

import { getPackageJson, getPluginJson, hasReadme, getEntries, isWSL } from './utils';
import { SOURCE_DIR, DIST_DIR } from './constants';
Expand All @@ -27,7 +27,7 @@ const config = async (env): Promise<Configuration> => {

context: path.join(process.cwd(), SOURCE_DIR),

devtool: env.production ? 'source-map' : 'eval-source-map',
devtool: 'source-map',

entry: {
...(await getEntries()),
Expand Down Expand Up @@ -59,8 +59,8 @@ const config = async (env): Promise<Configuration> => {
// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
({ request }, callback) => {
const prefix = 'grafana/';
const hasPrefix = request => request.indexOf(prefix) === 0;
const stripPrefix = request => request.substr(prefix.length);
const hasPrefix = (request) => request.indexOf(prefix) === 0;
const stripPrefix = (request) => request.substr(prefix.length);

if (hasPrefix(request)) {
return callback(undefined, stripPrefix(request));
Expand Down Expand Up @@ -128,6 +128,9 @@ const config = async (env): Promise<Configuration> => {
uniqueName: pluginJson.id,
},
plugins: [
new ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new CopyWebpackPlugin({
patterns: [
// If src/README.md exists use it; otherwise the root README
Expand Down Expand Up @@ -181,7 +184,7 @@ const config = async (env): Promise<Configuration> => {
modules: [path.resolve(process.cwd(), 'src'), 'node_modules'],
unsafeCache: true,
fallback: {
buffer: false,
buffer: require.resolve('buffer'),
fs: false,
stream: false,
http: false,
Expand Down

0 comments on commit e7ba861

Please sign in to comment.