From 281e80bb3bdc9ae9b17a5d9fa2e8707f290dcb71 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Wed, 7 Aug 2019 11:51:34 +0200 Subject: [PATCH] Only allow commonjs modules in external dependencies --- packages/auth/rollup.config.js | 4 +++- packages/auth/src/utils.js | 4 ++-- packages/auth/src/vars.js | 11 +++++++---- packages/auth/vendor/common | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/auth/rollup.config.js b/packages/auth/rollup.config.js index 48fb9fd7..92e6250b 100644 --- a/packages/auth/rollup.config.js +++ b/packages/auth/rollup.config.js @@ -26,7 +26,9 @@ export default { moduleDirectory: path.join(process.cwd(), 'node_modules') } }), - commonjs(), + commonjs({ + include: 'node_modules/**' + }), json(), replace({ "process.env.BUILD": '"' + build + '"', diff --git a/packages/auth/src/utils.js b/packages/auth/src/utils.js index 30eaa4ec..7e96c124 100644 --- a/packages/auth/src/utils.js +++ b/packages/auth/src/utils.js @@ -1,6 +1,6 @@ -const vars = require("./vars"); +import vars from './vars.js'; -module.exports = { +export default { getAPiUrl: function(path = "", withPrefix = true) { return vars.apiBaseUrl + (withPrefix ? vars.apiUrlPrefix : "") + path; }, diff --git a/packages/auth/src/vars.js b/packages/auth/src/vars.js index d34d7b63..741b34e2 100644 --- a/packages/auth/src/vars.js +++ b/packages/auth/src/vars.js @@ -1,7 +1,8 @@ +var config = undefined; switch(process.env.BUILD) { case "development": - module.exports = { + config = { apiBaseUrl: 'https://mw-dev.tugraz.at', apiUrlPrefix: '', keyCloakClientId: 'auth-dev-mw-frontend', @@ -9,14 +10,14 @@ switch(process.env.BUILD) { break; case "production": - module.exports = { + config = { apiBaseUrl: 'https://mw.tugraz.at', apiUrlPrefix: '', keyCloakClientId: 'auth-prod-mw-frontend', }; break; case "demo": - module.exports = { + config = { apiBaseUrl: 'https://api-demo.tugraz.at', apiUrlPrefix: '', keyCloakClientId: 'auth-dev-mw-frontend', @@ -24,9 +25,11 @@ switch(process.env.BUILD) { break; case "local": default: - module.exports = { + config = { apiBaseUrl: 'http://127.0.0.1:8000', apiUrlPrefix: '', keyCloakClientId: 'auth-dev-mw-frontend-local', }; } + +export default config; diff --git a/packages/auth/vendor/common b/packages/auth/vendor/common index 68e0a4f1..b30eaa64 160000 --- a/packages/auth/vendor/common +++ b/packages/auth/vendor/common @@ -1 +1 @@ -Subproject commit 68e0a4f1f1a3ef6e05aca5216bf8684578ec2229 +Subproject commit b30eaa6475ccc65b5f99d2ead86ddbe2b8e015a7 -- GitLab