Closed brenzi closed 3 years ago
very swift, thanks. Is there a fix for webpack too? OR do we have to use "build": "react-app-rewired build"
This rule for WP4 -
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
}
(WP5 handles it correctly, however having the above doesn't hurt WP5 in my testing either...)
yes, build runs through with this, but
WARNING in ./src/utils/fixpointUtil.js 65:22-29
"export 'default' (imported as 'bnToU8a') was not found in '@polkadot/util/bn/toU8a'
@ ./src/service/account.js
@ ./src/index.js
WARNING in ./src/utils/fixpointUtil.js 66:22-29
"export 'default' (imported as 'bnToU8a') was not found in '@polkadot/util/bn/toU8a'
@ ./src/service/account.js
@ ./src/index.js
WARNING in ./src/utils/fixpointUtil.js 70:13-20
"export 'default' (imported as 'bnToU8a') was not found in '@polkadot/util/bn/toU8a'
@ ./src/service/account.js
@ ./src/index.js
WARNING in ./src/service/account.js 27:20-32
"export 'default' (imported as 'generateIcon') was not found in '@polkadot/ui-shared/icons'
@ ./src/index.js
I guess this won't work....don't understand why these are warnings, not errors....
update WP to 5?
The latter error above is because you use direct imports from the tree itself. (i.e. not from the index). To make tree-shaking better, all exports inside the tree were changed to non-default exports, so where you used e.g.
// no issues
import { bnToU8a } from '@polkadot/util';
// this is also fine
import { bnToU8a } from '@polkadot/util/bn';
// this creates issues ... (see next, all inside-tree exports are named now, consistently)
import bnToU8a from '@polkadot/util/bn/toU8a';
// this is the adjustment needed
import { bnToU8a } from '@polkadot/util/bn/toU8a';
So, I can really recommend a bump to WP5, it is orders of a magnitude better in creating smaller bundles - in the extension UI we saw a drop from 2.8MB to 1MB... that is an outlier, the apps UI itself only showed around 10%).
However, it is effort and it certainly is not required at all here. So when you have some free time at some point, I can recommend it.
The above is just due to the in-tree non-default export changes. (For most this would have been transparent since they would have imported from the root)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.
I'm using @polkadot-js/api 3.1.1 in a mobile webview. Since upgrading from 2.3.1 I get:
Here's my package.json