This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add override mechanism for webpack config (getredash#5057)
- Loading branch information
Showing
2 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
You can use this folder to add scripts and configurations to customize Redash build and development loop. | ||
|
||
## 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`): | ||
|
||
```javascript | ||
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. | ||
|
||
```javascript | ||
function applyOverrides(webpackConfig) { | ||
return { | ||
...webpackConfig, | ||
stats: { | ||
children: true, | ||
modules: true, | ||
chunkModules: true | ||
} | ||
}; | ||
} | ||
|
||
module.exports = applyOverrides; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters