From 3502181b792bfbb0b7fb1703165fb04310527aae Mon Sep 17 00:00:00 2001 From: Siwei Zhang Date: Mon, 8 Apr 2024 11:05:31 +0200 Subject: [PATCH] Add webpack.config.js to docker example Some views like statistics view have features to right-click on the entries and select time ranges, but this feature requires some Node.js-specific features like "process", which is missing for the docker example. Fixes #1066 Signed-off-by: Siwei Zhang --- examples/docker/Dockerfile | 1 + examples/docker/webpack.config.js | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 examples/docker/webpack.config.js diff --git a/examples/docker/Dockerfile b/examples/docker/Dockerfile index f02eb5051..99bbcba2a 100644 --- a/examples/docker/Dockerfile +++ b/examples/docker/Dockerfile @@ -12,6 +12,7 @@ RUN apt-get update && apt-get install -y \ # Build the browser theia-trace-extension application COPY example-package.json /app/tte/package.json +COPY webpack.config.js /app/tte/webpack.config.js WORKDIR /app/tte/ RUN yarn && \ npx theia build --app-target=\"browser\" --mode production && \ diff --git a/examples/docker/webpack.config.js b/examples/docker/webpack.config.js new file mode 100644 index 000000000..97c946d56 --- /dev/null +++ b/examples/docker/webpack.config.js @@ -0,0 +1,25 @@ +/** + * This file can be edited to customize webpack configuration. + * To reset delete this file and rerun theia build again. + */ +// @ts-check +const config = require('./gen-webpack.config.js'); +const webpack = require("webpack"); + + +/** + * Expose bundled modules on window.theia.moduleName namespace, e.g. + * window['theia']['@theia/core/lib/common/uri']. + * Such syntax can be used by external code, for instance, for testing. +config.module.rules.push({ + test: /\.js$/, + loader: require.resolve('@theia/application-manager/lib/expose-loader') +}); */ + +config[0].plugins.push(new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development') + } +})); + +module.exports = config; \ No newline at end of file