Skip to content

Commit

Permalink
build: updated webpack.prod.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
awais-ansari committed Sep 25, 2024
1 parent 47b0501 commit f799a48
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { createConfig } = require('@openedx/frontend-build');

module.exports = createConfig('eslint', {
const config = createConfig('eslint', {
rules: {
// Temporarily update the 'indent', 'template-curly-spacing' and
// 'no-multiple-empty-lines' rules since they are causing eslint
Expand Down Expand Up @@ -50,3 +50,14 @@ module.exports = createConfig('eslint', {
'function-paren-newline': 'off',
},
});

config.settings = {
'import/resolver': {
node: {
paths: ['src', 'node_modules'],
extensions: ['.js', '.jsx'],
},
},
};

module.exports = config;
60 changes: 60 additions & 0 deletions example.env.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
Authn MFE is now able to handle JS-based configuration!
For the time being, the `.env.*` files are still made available when cloning down this repo or pulling from
the master branch. To switch to using `env.config.js`, make a copy of `example.env.config.js` and configure as needed.
For testing with Jest Snapshot, there is a mock in `/src/setupTest.jsx` for `getConfig` that will need to be
uncommented.
Note: having both .env and env.config.js files will follow a predictable order, in which non-empty values in the
JS-based config will overwrite the .env environment variables.
frontend-platform's getConfig loads configuration in the following sequence:
- .env file config
- optional handlers (commonly used to merge MFE-specific config in via additional process.env variables)
- env.config.js file config
- runtime config
*/

module.exports = {
NODE_ENV: 'development',
NODE_PATH: './src',
PORT: 1999,
ACCESS_TOKEN_COOKIE_NAME: 'edx-jwt-cookie-header-payload',
BASE_URL: 'http://localhost:1999',
CREDENTIALS_BASE_URL: 'http://localhost:18150',
CSRF_TOKEN_API_PATH: '/csrf/api/v1/token',
ECOMMERCE_BASE_URL: 'http://localhost:18130',
LANGUAGE_PREFERENCE_COOKIE_NAME: 'openedx-language-preference',
LMS_BASE_URL: 'http://localhost:18000',
LOGIN_URL: 'http://localhost:1999/login',
LOGOUT_URL: 'http://localhost:18000/logout',
LOGO_URL: 'https://edx-cdn.org/v3/default/logo.svg',
LOGO_TRADEMARK_URL: 'https://edx-cdn.org/v3/default/logo-trademark.svg',
LOGO_WHITE_URL: 'https://edx-cdn.org/v3/default/logo-white.svg',
FAVICON_URL: 'https://edx-cdn.org/v3/default/favicon.ico',
MARKETING_SITE_BASE_URL: 'http://localhost:18000',
ORDER_HISTORY_URL: 'http://localhost:1996/orders',
REFRESH_ACCESS_TOKEN_ENDPOINT: 'http://localhost:18000/login_refresh',
SEGMENT_KEY: '',
SITE_NAME: 'Your Platform Name Here',
INFO_EMAIL: '[email protected]',
ENABLE_DYNAMIC_REGISTRATION_FIELDS: 'true',
ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: 'true',
SESSION_COOKIE_DOMAIN: 'localhost',
USER_INFO_COOKIE_NAME: 'edx-user-info',
LOGIN_ISSUE_SUPPORT_LINK: 'http://localhost:18000/login-issue-support-url',
TOS_AND_HONOR_CODE: 'http://localhost:18000/honor',
TOS_LINK: 'http://localhost:18000/tos',
PRIVACY_POLICY: 'http://localhost:18000/privacy',
AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: 'http://localhost:1999/welcome',
BANNER_IMAGE_LARGE: '',
BANNER_IMAGE_MEDIUM: '',
BANNER_IMAGE_SMALL: '',
BANNER_IMAGE_EXTRA_SMALL: '',
APP_ID: '',
MFE_CONFIG_API_URL: '',
ZENDESK_KEY: '',
ZENDESK_LOGO_URL: '',
};
14 changes: 14 additions & 0 deletions webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const path = require('path');

Check failure on line 1 in webpack.dev.config.js

View workflow job for this annotation

GitHub Actions / tests (18)

There should be at least one empty line between import groups

Check failure on line 1 in webpack.dev.config.js

View workflow job for this annotation

GitHub Actions / tests (20)

There should be at least one empty line between import groups
const { createConfig } = require('@openedx/frontend-build');

const config = createConfig('webpack-dev');

config.resolve.modules = [
path.resolve(__dirname, './src'),
'node_modules',
];

config.module.rules[0].exclude = /node_modules\/(?!(fastest-levenshtein|@edx))/;


Check failure on line 13 in webpack.dev.config.js

View workflow job for this annotation

GitHub Actions / tests (18)

More than 1 blank line not allowed

Check failure on line 13 in webpack.dev.config.js

View workflow job for this annotation

GitHub Actions / tests (20)

More than 1 blank line not allowed
module.exports = config;
7 changes: 7 additions & 0 deletions webpack.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
const path = require('path');

const { createConfig } = require('@openedx/frontend-build');

const config = createConfig('webpack-prod');

config.resolve.modules = [
path.resolve(__dirname, './src'),
'node_modules',
];

config.module.rules[0].exclude = /node_modules\/(?!(fastest-levenshtein|@edx))/;

module.exports = config;

0 comments on commit f799a48

Please sign in to comment.