mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05: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'))
|
const emojiPickerDataModulePath = path.dirname(require.resolve('emoji-picker-element-data/en/emojibase/data.json'))
|
||||||
|
|
||||||
config.plugins.push(
|
config.plugins.push(
|
||||||
new CopyWebpackPlugin({
|
new CopyWebpackPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
{ from: path.join(wasmModulePath, 'graphvizlib.wasm'), to: 'static/js' },
|
|
||||||
{ from: path.join(wasmModulePath, 'expatlib.wasm'), to: 'static/js' },
|
|
||||||
{
|
{
|
||||||
from: emojiPickerDataModulePath,
|
from: emojiPickerDataModulePath,
|
||||||
to: 'static/js/emoji-data.json'
|
to: 'static/js/emoji-data.json'
|
||||||
|
|
|
@ -30,15 +30,7 @@ export const GraphvizFrame: React.FC<CodeProps> = ({ code }) => {
|
||||||
value: graphvizImport,
|
value: graphvizImport,
|
||||||
error: libLoadingError,
|
error: libLoadingError,
|
||||||
loading: isLibLoading
|
loading: isLibLoading
|
||||||
} = useAsync(
|
} = useAsync(() => import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz'), [])
|
||||||
async () =>
|
|
||||||
import(/* webpackChunkName: "d3-graphviz" */ '@hpcc-js/wasm')
|
|
||||||
.then((wasmPlugin) => {
|
|
||||||
wasmPlugin.wasmFolder(`${basePath}/_next/static/js`)
|
|
||||||
})
|
|
||||||
.then(() => import(/* webpackChunkName: "d3-graphviz" */ 'd3-graphviz')),
|
|
||||||
[]
|
|
||||||
)
|
|
||||||
|
|
||||||
const showError = useCallback((error: string) => {
|
const showError = useCallback((error: string) => {
|
||||||
if (!container.current) {
|
if (!container.current) {
|
||||||
|
|
Loading…
Reference in a new issue