Skip to content

Commit

Permalink
Remove Monaco Editor Webpack Plugin and Manually Vendor Editor Workers (
Browse files Browse the repository at this point in the history
#362)

* Removed *.bundle.js from editor WebWorkers

* Removed Monaco Editor Plugin

* package.lock -> yarn.lock
  • Loading branch information
subhankar-panda authored May 13, 2020
1 parent 44fde22 commit fefb5a3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
},
};

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 9 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -37,9 +43,6 @@ module.exports = {
TextDecoder: ["text-encoding", "TextDecoder"],
TextEncoder: ["text-encoding", "TextEncoder"],
}),
new MonacoWebpackPlugin({
languages: ["javascript"],
}),
],
module: {
rules: [
Expand Down
6 changes: 0 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit fefb5a3

Please sign in to comment.