Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/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