mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Fix webpack config for react Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Introduce package for discovering html elements in unit tests Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using discovery of html elements from package Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Introduce competition for starting react application inside the Feature Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Move stuff in application start to earlier timeslot having no real need to be done so late Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using react application root feature being more friendly to extending Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using more familiar pattern of higher order components for wrapping react application Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Adapt to more familiar pattern for higher order components Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Rename feature for clarity Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> --------- Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> |
||
|---|---|---|
| .. | ||
| src | ||
| index.js | ||
| jest.config.js | ||
| package.json | ||
| README.md | ||
@k8slens/webpack
This package contains webpack configurations for Lens packages.
Install
$ npm install @k8slens/webpack
Features
Configurations
Node package
This configuration should be used when creating package that will be executed within Node environment.
webpack.config.js
module.exports = require("@k8slens/webpack").configForNode;
React package
This configuration should be used when creating package tha will be executed within Browser environment.
webpack.config.js
module.exports = require("@k8slens/webpack").configForReact;
Multi export package
This configuration should be used when package contains multiple entrypoint e.g. for different environments. You need to add lensMultiExportConfig to package.json with configuration. Note that also exports property needs to be set, but the correct values are generated from lensMultiExportConfig when using lens-build -script.
webpack.config.js
const packageJson = require("./package.json");
module.exports = require("@k8slens/webpack").getMultiExportConfig(packageJson);
package.json
{
"lensMultiExportConfig": {
"./main": {
"buildType": "node",
"entrypoint": "./src/main/index.ts"
},
"./renderer": {
"buildType": "react",
"entrypoint": "./src/renderer/index.ts"
}
},
"exports": {
"./main": {
"types": "./dist/main/index.d.ts",
"require": "./dist/main/index.js",
"import": "./dist/main/index.js",
"default": "./dist/main/index.js"
},
"./renderer": {
"types": "./dist/renderer/index.d.ts",
"require": "./dist/renderer/index.js",
"import": "./dist/renderer/index.js",
"default": "./dist/renderer/index.js"
}
}
}
Scripts
lens-buildwhich builds the packageslens-remove-buildwhich removes the build directory from packages. It's useful for cleaning up.