Fic website building
This commit is contained in:
parent
dd2a664d79
commit
23ae960372
2 changed files with 25 additions and 16 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import wasmInit, {
|
import {
|
||||||
CursorPosition as wasmCursorPosition,
|
CursorPosition as wasmCursorPosition,
|
||||||
reconcile as wasmReconcile,
|
reconcile as wasmReconcile,
|
||||||
TextWithCursors as wasmTextWithCursors,
|
TextWithCursors as wasmTextWithCursors,
|
||||||
|
|
@ -9,7 +9,7 @@ import wasmInit, {
|
||||||
initSync,
|
initSync,
|
||||||
} from 'reconcile';
|
} from 'reconcile';
|
||||||
|
|
||||||
import wasm from 'reconcile/reconcile_bg.wasm';
|
import wasmBytes from 'reconcile/reconcile_bg.wasm';
|
||||||
|
|
||||||
export interface TextWithCursors {
|
export interface TextWithCursors {
|
||||||
/** The document's entire content */
|
/** The document's entire content */
|
||||||
|
|
@ -131,7 +131,10 @@ function init() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
initSync({ module: (wasm as any).default });
|
const wasmBinary = Uint8Array.from(atob(wasmBytes as unknown as string), (c) =>
|
||||||
|
c.charCodeAt(0)
|
||||||
|
);
|
||||||
|
initSync({ module: wasmBinary });
|
||||||
|
|
||||||
isInitialised = true;
|
isInitialised = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,6 @@ const { merge } = require('webpack-merge');
|
||||||
|
|
||||||
const common = {
|
const common = {
|
||||||
entry: './src/index.ts',
|
entry: './src/index.ts',
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.ts$/,
|
|
||||||
use: ['ts-loader'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.wasm$/,
|
|
||||||
type: 'asset/inline',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
optimization: {
|
optimization: {
|
||||||
// the consuming project should take care of minification
|
// the consuming project should take care of minification
|
||||||
minimize: false,
|
minimize: false,
|
||||||
|
|
@ -27,7 +15,25 @@ const common = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
performance: {
|
performance: {
|
||||||
hints: false, // it's a library, no need to warn about its size
|
hints: false,
|
||||||
|
},
|
||||||
|
experiments: {
|
||||||
|
asyncWebAssembly: true,
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.ts$/,
|
||||||
|
use: ['ts-loader'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.wasm$/,
|
||||||
|
type: 'asset/inline',
|
||||||
|
generator: {
|
||||||
|
dataUrl: (content) => content.toString('base64'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue