Browse Source

Remove Monaco Editor Webpack Plugin and Manually Vendor Editor Workers (#362)

* Removed *.bundle.js from editor WebWorkers

* Removed Monaco Editor Plugin

* package.lock -> yarn.lock
pull/407/head
Subhankar Panda 5 years ago committed by GitHub
parent
commit
fefb5a3b71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      index.js
  2. 1
      package.json
  3. 15
      webpack.config.js
  4. 6
      yarn.lock

12
index.js

@ -4,21 +4,21 @@
const rust = import("./boa_wasm/pkg");
import * as monaco from "monaco-editor";
self.MonacoEnvironment = {
window.MonacoEnvironment = {
getWorkerUrl: function (moduleId, label) {
if (label === "json") {
return "./json.worker.bundle.js";
return "./json.worker.js";
}
if (label === "css") {
return "./css.worker.bundle.js";
return "./css.worker.js";
}
if (label === "html") {
return "./html.worker.bundle.js";
return "./html.worker.js";
}
if (label === "typescript" || label === "javascript") {
return "./ts.worker.bundle.js";
return "./ts.worker.js";
}
return "./editor.worker.bundle.js";
return "./editor.worker.js";
},
};

1
package.json

@ -11,7 +11,6 @@
"css-loader": "^3.2.0",
"file-loader": "^5.0.2",
"html-webpack-plugin": "^3.2.0",
"monaco-editor-webpack-plugin": "^1.9.0",
"style-loader": "^1.0.0",
"text-encoding": "^0.7.0",
"webpack": "^4.40.2",

15
webpack.config.js

@ -4,13 +4,19 @@ const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const webpack = require("webpack");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
module.exports = {
entry: "./index.js",
entry: {
app: "./index.js",
"editor.worker": 'monaco-editor/esm/vs/editor/editor.worker.js',
"json.worker": 'monaco-editor/esm/vs/language/json/json.worker',
"css.worker": 'monaco-editor/esm/vs/language/css/css.worker',
"html.worker": 'monaco-editor/esm/vs/language/html/html.worker',
"ts.worker": 'monaco-editor/esm/vs/language/typescript/ts.worker',
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "index.js",
filename: "[name].js",
},
plugins: [
new CleanWebpackPlugin(),
@ -37,9 +43,6 @@ module.exports = {
TextDecoder: ["text-encoding", "TextDecoder"],
TextEncoder: ["text-encoding", "TextEncoder"],
}),
new MonacoWebpackPlugin({
languages: ["javascript"],
}),
],
module: {
rules: [

6
yarn.lock

@ -2262,12 +2262,6 @@ mkdirp@^0.5.1, mkdirp@^0.5.3:
dependencies:
minimist "^1.2.5"
monaco-editor-webpack-plugin@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.9.0.tgz#5b547281b9f404057dc5d8c5722390df9ac90be6"
dependencies:
loader-utils "^1.2.3"
monaco-editor@^0.20.0:
version "0.20.0"
resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.20.0.tgz#5d5009343a550124426cb4d965a4d27a348b4dea"

Loading…
Cancel
Save