@ovh-ux/manager-webpack-config
v7.0.4
Published
OVHcloud manager shared webpack configuration.
Downloads
142
Readme
Manager Webpack Config
Extensible webpack configuration for the OVH Manager.
Install
yarn add -D @ovh-ux/manager-webpack-config
Usage
The webpack configuration can be imported and extended in the manager. To import the configuration, simply add manager-webpack-config as a devDependency.
In order to use and extends this configuration, some manager relative parameters needs to be provided. Please refer to the parameters and example below.
Parameters
The following configuration parameters needs to be provided:
- template: path to manager main template file
- basePath: the base path of the manager
- lessPath: manager paths containing less files
- root: root path of the manager
- assets.files: see https://github.com/webpack-contrib/copy-webpack-plugin
The following configuration parameters are optionals:
- assets.options: see https://github.com/webpack-contrib/copy-webpack-plugin
- translationsRoot: by default, ui-router-translation loader resolves translations relatively to the current resource path. You can override this behavior by providing an absolute translationsRoot path. This path will then be used to resolve translations instead of current resource path.
- lessJavascriptEnabled: adds javascriptEnabled option to the less compiler
Example
// import config and initialize parameters
const { config } = require('@ovh-ux/manager-webpack-config')({
template: './client/index.html',
basePath: './client',
lessPath: ['./client/app', './client/components', './node_modules'],
root: path.resolve(__dirname, './client/app'),
assets: {
files: [
{
from: path.resolve(__dirname, './client/app/common/assets'),
to: 'assets',
},
],
},
});
// merge the configuration and export it
module.exports = merge(config, {
entry: _.assign({
main: './client/app/index.js',
}),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[chunkhash].bundle.js',
},
});
Related
- manager-webpack-dev-server - OVH manager webpack development server configuration
Contributing
Always feel free to help out! Whether it's filing bugs and feature requests or working on some of the open issues, our contributing guide will help get you started.
License
BSD-3-Clause © OVH SAS