Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add override mechanism to customize default Webpack config #5057

Merged

Conversation

benamorbe
Copy link
Contributor

@benamorbe benamorbe commented Jul 20, 2020

What type of PR is this? (check all applicable)

  • Other

Description

This PR adds the possibility to customize Redash build and development loop by applying custom configuration and/or overrides to Webpack.

How to customize Webpack

Configurable parameters

You can override the values of configurable parameters by exporting a CONFIG object from the module located at scripts/config.

Currently the following parameters are supported:

  • staticPath: Override the location of Redash static files (default = /static/).

Example Configuration (scripts/config.js):

module.exports = {
  staticPath: "my/redash/static/path"
};

Programmatically

For advanced customization, you can provide a script to apply any kind of overrides to the default config as provided by webpack.config.js.

The override module must be located under scripts/webpack/overrides. It should export a function that receives the Webpack configuration object and returns the overridden version.

Example Override Script (scripts/webpack/overrides.js):

This is an example of an override that enables Webpack stats.

function applyOverrides(webpackConfig) {
  return {
    ...webpackConfig,
    stats: {
      children: true,
      modules: true,
      chunkModules: true
    }
  };
}

module.exports = applyOverrides;

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

@arikfr arikfr merged commit 2dacd08 into getredash:master Jul 27, 2020
@arikfr
Copy link
Member

arikfr commented Jul 27, 2020

👍

andrewdever pushed a commit to andrewdever/redash that referenced this pull request Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants