Browser bundle build (incomplete) (#503)

* Browser bundle build (incomplete)

* globals
This commit is contained in:
Jaco
2021-07-09 16:30:05 +03:00
committed by GitHub
parent f2189f3780
commit 2d801b535e
4 changed files with 65 additions and 2 deletions
+1
View File
@@ -13,6 +13,7 @@
"scripts": {
"build": "polkadot-dev-build-ts",
"build:release": "polkadot-ci-ghact-build",
"build:rollup": "polkadot-exec-rollup --config",
"lint": "polkadot-dev-run-lint",
"clean": "polkadot-dev-clean-build",
"demo:identicon:react": "yarn build && webpack-serve --config packages/react-identicon/webpack.config.js --content packages/react-identicon --port 8080",
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/vue-identicon authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { Identicon } from './Identicon';
export { packageInfo } from './packageInfo';
+2 -2
View File
@@ -3,8 +3,8 @@
import './detectPackage';
import { Identicon } from './Identicon';
import { Identicon } from './bundle';
export { packageInfo } from './packageInfo';
export * from './bundle';
export default Identicon;
+56
View File
@@ -0,0 +1,56 @@
// Copyright 2017-2021 @polkadot/ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
import path from 'path';
import { createBundle } from '@polkadot/dev/config/rollup';
const pkgs = [
'@polkadot/react-identicon',
'@polkadot/react-qr',
'@polkadot/ui-keyring',
'@polkadot/ui-settings',
'@polkadot/ui-shared',
'@polkadot/vue-identicon'
];
const external = [
...pkgs,
'@polkadot/keyring',
'@polkadot/util',
'@polkadot/util-crypto',
'react',
'react-dom',
'vue'
];
const globals = {
react: 'React',
'react-dom': 'ReactDOM',
vue: 'Vue'
};
const entries = ['api-derive', 'rpc-core', 'rpc-provider', 'types-known'].reduce((all, p) => ({
...all,
[`@polkadot/${p}`]: path.resolve(process.cwd(), `packages/${p}/build/bundle.js`)
}), {
// re-exported in @polkadot/util-crypto, map directly
'@polkadot/networks': '@polkadot/util-crypto'
});
const overrides = {};
export default pkgs.map((pkg) => {
const override = (overrides[pkg] || {});
return createBundle({
external,
globals,
pkg,
...override,
entries: {
...entries,
...(override.entries || {})
}
});
});