From 7e25e71069327b1d6bc39fb160f690c8eecec731 Mon Sep 17 00:00:00 2001 From: Alex <apuret@e-biz.fr> Date: Wed, 5 Aug 2020 11:46:34 +0200 Subject: [PATCH] chore: set cors config to webpack --- Dockerfile | 1 + webpack.config.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 webpack.config.js diff --git a/Dockerfile b/Dockerfile index 6686f39f..c47075b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM theiaide/theia-java:1.3.0 +COPY webpack.config.js /home/theia/webpack.config.js COPY plugins /home/plugins ENTRYPOINT [ "yarn", "theia", "start", "/home/project", "--hostname=0.0.0.0", "--plugins=local-dir:/home/plugins"] diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..1b706078 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,23 @@ +/** + * 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'); + +config.devServer: { + headers: { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS", + "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization" + } +} + +/** + * 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') +}); */ -- GitLab