Skip to content

Commit

Permalink
#2654 - Improve WASM loading performance
Browse files Browse the repository at this point in the history
- added two ketcher-standalone builds: with base64 indigo wasm and with separate wasm file
  • Loading branch information
rrodionov91 committed Jun 25, 2024
1 parent cb53f9e commit 5fc154a
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 25 deletions.
11 changes: 11 additions & 0 deletions example/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
const webpack = require('webpack');
const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');

const gitRevisionPlugin = new GitRevisionPlugin();
const applicationVersion = gitRevisionPlugin.version().split('-')[0];
Expand Down Expand Up @@ -35,6 +36,16 @@ module.exports = override(
},
]),
),
addWebpackPlugin(
new CopyPlugin({
patterns: [
{
from: '../node_modules/ketcher-standalone/**/*.wasm',
to: '[name][ext]',
},
],
}),
),
);

module.exports.envVariables = envVariables;
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@types/react-dom": "^18.0.8",
"@vitejs/plugin-react": "^4.0.0",
"@welldone-software/why-did-you-render": "^4.3.1",
"copy-webpack-plugin": "^12.0.2",
"cross-env": "^7.0.3",
"customize-cra": "^1.0.0",
"eslint": "^8.44.0",
Expand Down
190 changes: 188 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions packages/ketcher-standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"node": ">=14"
},
"scripts": {
"build": "cross-env NODE_ENV=production rollup -c -m true",
"build": "cross-env NODE_ENV=production rollup -c -m true && cross-env NODE_ENV=production BINARY_WASM=true rollup -c -m true",
"start": "cross-env NODE_ENV=development rollup -c -m true -w",
"test": "run-s test:prettier test:eslint:quiet test:types test:unit",
"test:eslint": "eslint . --ext .ts,.js",
Expand All @@ -50,9 +50,10 @@
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-strip": "^2.0.0",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.12",
Expand All @@ -74,5 +75,15 @@
},
"files": [
"dist"
]
],
"exports": {
".": {
"import": "./dist/index.modern.js",
"require": "./dist/index.js"
},
"./dist/binaryWasm": {
"import": "./dist/binaryWasm/index.modern.js",
"require": "./dist/binaryWasm/index.js"
}
}
}
Loading

0 comments on commit 5fc154a

Please sign in to comment.