Fix a warning on start-up about freezing the UI

The console log would show

  "Could not create web worker(s). Falling back to loading web worker code
  in main thread, which might cause UI freezes. Please see
  https://github.com/Microsoft/monaco-editor#faq"

and

  "VM3793 simpleWorker.js:29 You must define a function
  MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker"

when loading. This is fixed by using the monaco editor webpack plugin, which
ensures that the workers are loaded via async script tags.
This commit is contained in:
Simon Hausmann 2020-10-06 10:20:34 +02:00
parent 72c80b41d0
commit 2041144f45

View file

@ -1,6 +1,7 @@
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const dist = path.resolve(__dirname, "dist");
module.exports = {
@ -45,5 +46,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, "../../api/sixtyfps-wasm-interpreter/"),
}),
new MonacoWebpackPlugin(),
]
};