Skip to content

Commit

Permalink
- experiments to use esm with wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
rrodionov91 committed Jan 16, 2025
1 parent dd5cb76 commit 2778488
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 18 deletions.
192 changes: 183 additions & 9 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions packages/ketcher-standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@
"@rollup/plugin-strip": "^2.0.0",
"@rollup/plugin-url": "^8.0.2",
"@rollup/plugin-wasm": "^6.2.2",
"@surma/rollup-plugin-off-main-thread": "^2.2.3",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.12",
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
"cross-env": "^7.0.3",
"eslint": "^8.44.0",
"eslint-plugin-jest": "^25.3.0",
Expand Down
11 changes: 3 additions & 8 deletions packages/ketcher-standalone/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { license } from '../../license.ts';
import replace from '@rollup/plugin-replace';
import wasm from '@rollup/plugin-wasm';
import url from '@rollup/plugin-url';
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
import OMT from '@surma/rollup-plugin-off-main-thread';

const mode = {
PRODUCTION: 'production',
Expand All @@ -26,7 +28,6 @@ const includePattern = 'src/**/*';
const baseConfig = {
input: {
index: 'src/index.ts',
indigoWorker: 'src/infrastructure/services/struct/indigoWorker.ts',
},
external: ['ketcher-core', /@babel\/runtime/],
plugins: [
Expand All @@ -48,7 +49,6 @@ const baseConfig = {
'process.env.SEPARATE_INDIGO_RENDER': process.env.SEPARATE_INDIGO_RENDER,
}),
...(isProduction ? [strip({ include: includePattern })] : []),
wasm(),
],
};

Expand Down Expand Up @@ -88,12 +88,6 @@ const configWithWasmBase64 = {
const configWithWasmFetch = {
...baseConfig,
output: [
{
dir: 'dist/cjs/binaryWasm',
exports: 'named',
format: 'cjs',
banner: license,
},
{
dir: 'dist/binaryWasm',
exports: 'named',
Expand All @@ -111,6 +105,7 @@ const configWithWasmFetch = {
},
],
}),
OMT(),
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import {
} from './constants';

const indigoWorker: Worker = new Worker(
new URL('./indigoWorker', import.meta.url),
new URL('./indigoWorker2.js', import.meta.url),
{ type: 'module' },
);

Expand Down

0 comments on commit 2778488

Please sign in to comment.