Skip to content

Commit 5fc154a

Browse files
committed
#2654 - Improve WASM loading performance
- added two ketcher-standalone builds: with base64 indigo wasm and with separate wasm file
1 parent cb53f9e commit 5fc154a

File tree

5 files changed

+278
-25
lines changed

5 files changed

+278
-25
lines changed

example/config/webpack.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77
const webpack = require('webpack');
88
const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin');
99
const GitRevisionPlugin = require('git-revision-webpack-plugin');
10+
const CopyPlugin = require('copy-webpack-plugin');
1011

1112
const gitRevisionPlugin = new GitRevisionPlugin();
1213
const applicationVersion = gitRevisionPlugin.version().split('-')[0];
@@ -35,6 +36,16 @@ module.exports = override(
3536
},
3637
]),
3738
),
39+
addWebpackPlugin(
40+
new CopyPlugin({
41+
patterns: [
42+
{
43+
from: '../node_modules/ketcher-standalone/**/*.wasm',
44+
to: '[name][ext]',
45+
},
46+
],
47+
}),
48+
),
3849
);
3950

4051
module.exports.envVariables = envVariables;

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"@types/react-dom": "^18.0.8",
5757
"@vitejs/plugin-react": "^4.0.0",
5858
"@welldone-software/why-did-you-render": "^4.3.1",
59+
"copy-webpack-plugin": "^12.0.2",
5960
"cross-env": "^7.0.3",
6061
"customize-cra": "^1.0.0",
6162
"eslint": "^8.44.0",

package-lock.json

Lines changed: 188 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ketcher-standalone/package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"node": ">=14"
3030
},
3131
"scripts": {
32-
"build": "cross-env NODE_ENV=production rollup -c -m true",
32+
"build": "cross-env NODE_ENV=production rollup -c -m true && cross-env NODE_ENV=production BINARY_WASM=true rollup -c -m true",
3333
"start": "cross-env NODE_ENV=development rollup -c -m true -w",
3434
"test": "run-s test:prettier test:eslint:quiet test:types test:unit",
3535
"test:eslint": "eslint . --ext .ts,.js",
@@ -50,9 +50,10 @@
5050
"@babel/plugin-transform-runtime": "^7.17.0",
5151
"@babel/preset-env": "^7.16.11",
5252
"@babel/preset-typescript": "^7.16.7",
53+
"@rollup/plugin-alias": "^3.1.9",
5354
"@rollup/plugin-babel": "^5.2.1",
5455
"@rollup/plugin-commonjs": "^16.0.0",
55-
"@rollup/plugin-node-resolve": "^10.0.0",
56+
"@rollup/plugin-node-resolve": "^15.2.3",
5657
"@rollup/plugin-strip": "^2.0.0",
5758
"@types/jest": "^27.0.3",
5859
"@types/node": "^16.11.12",
@@ -74,5 +75,15 @@
7475
},
7576
"files": [
7677
"dist"
77-
]
78+
],
79+
"exports": {
80+
".": {
81+
"import": "./dist/index.modern.js",
82+
"require": "./dist/index.js"
83+
},
84+
"./dist/binaryWasm": {
85+
"import": "./dist/binaryWasm/index.modern.js",
86+
"require": "./dist/binaryWasm/index.js"
87+
}
88+
}
7889
}

0 commit comments

Comments
 (0)