mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-22 23:42:15 +00:00
fix(frontend): migrate to new wasm loading method
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
bf777704a6
commit
5a36b13091
2 changed files with 1 additions and 12 deletions
|
@ -58,14 +58,11 @@ const rawNextConfig = {
|
|||
]
|
||||
})
|
||||
|
||||
const wasmModulePath = path.dirname(require.resolve('@hpcc-js/wasm'))
|
||||
const emojiPickerDataModulePath = path.dirname(require.resolve('emoji-picker-element-data/en/emojibase/data.json'))
|
||||
|
||||
config.plugins.push(
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: path.join(wasmModulePath, 'graphvizlib.wasm'), to: 'static/js' },
|
||||
{ from: path.join(wasmModulePath, 'expatlib.wasm'), to: 'static/js' },
|
||||
{
|
||||
from: emojiPickerDataModulePath,
|
||||
to: 'static/js/emoji-data.json'
|
||||
|
|
|
@ -30,15 +30,7 @@ export const GraphvizFrame: React.FC<CodeProps> = ({ code }) => {
|
|||
value: graphvizImport,
|
||||
error: libLoadingError,
|
||||
loading: isLibLoading
|
||||
} = useAsync(
|
||||
async () =>
|
||||
import(/* webpackChunkName: "d3-graphviz" */ '@hpcc-js/wasm')
|
||||
.then((wasmPlugin) => {
|
||||
wasmPlugin.wasmFolder(`${basePath}/_next/static/js`)
|
||||
})
|
||||
.then(() => import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz')),
|
||||
[]
|
||||
)
|
||||
} = useAsync(() => import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz'), [])
|
||||
|
||||
const showError = useCallback((error: string) => {
|
||||
if (!container.current) {
|
||||
|
|
Loading…
Reference in a new issue