make monaco workers available in static folder (#106)

* fixes

* make monaco workers available in static folder

* fixes

* fixes

* fix(worker): monaco workers path
This commit is contained in:
Ritesh Kumar authored and GitHub committed 2019-07-19 11:51:51 +05:30
1 parent b962207956
commit eb68108b67
5 files changed
+36 -28

No files matched your search

+1 -3
View File
@@ -107,7 +107,7 @@ export default function({
useEffect(() => {
// @ts-ignore
window.__webpack_public_path__ = "/static/";
window.__webpack_public_path__ = "/_next/static/";
}, []);
const getSettings = useCallback(
@@ -182,8 +182,6 @@ export default function({
setValue(defaultValue);
}, [defaultValue]);
console.log(showPreview);
return (
<Pane display="flex" flex={1} flexDirection="column" overflow="hidden">
<Pane
+21
View File
@@ -3,6 +3,27 @@ import { editor } from "monaco-editor";
import { Pane } from "evergreen-ui";
import { lightEditor } from "@utils/theme";
const publicDest = IS_DEV ? "/static" : "/_next/static";
// @ts-ignore
self.MonacoEnvironment = {
getWorkerUrl: function(_moduleId, label) {
if (label === "json") {
return `.${publicDest}/json.worker.js`;
}
if (label === "css") {
return `.${publicDest}/css.worker.js`;
}
if (label === "html") {
return `.${publicDest}/html.worker.js`;
}
if (label === "typescript" || label === "javascript") {
return `.${publicDest}/typescript.worker.js`;
}
return `.${publicDest}/editor.worker.js`;
}
};
function noop() {}
export function processSize(size) {
+1 -1
View File
@@ -10,7 +10,7 @@
"start": "next start",
"format": "prettier --write '**/*.ts' '**/*.tsx'",
"build": "next build",
"now-build": "next build",
"now-build": "next build && cp -r ./static/* .next/static",
"postinstall": "patch-package"
},
"engines": {
+1 -1
View File
@@ -5,7 +5,7 @@ import Navigator from "@components/Navigator";
import "@styles/main.css";
import NProgress from "nprogress";
import Router, { useRouter } from "next/router";
import { useRouter } from "next/router";
import { activeRouteData } from "@utils/routes";
const logo = (
+12 -23
View File
@@ -8,31 +8,15 @@ interface DocumentProps {
}
function trackingScript() {
(function(i, s, o, g, r, a, m) {
i["GoogleAnalyticsObject"] = r;
(i[r] =
i[r] ||
function() {
(i[r].q = i[r].q || []).push(arguments);
}),
// @ts-ignore
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(
window,
document,
"script",
"https://www.google-analytics.com/analytics.js",
"ga"
);
window["dataLayer"] = window["dataLayer"] || [];
function gtag() {
window["dataLayer"].push(arguments);
}
// @ts-ignore
gtag("js", new Date());
// @ts-ignore
window.ga("create", "UA-60624235-5", "auto");
// @ts-ignore
window.ga("send", "pageview");
gtag("config", "UA-60624235-5");
}
export default class MyDocument extends Document<DocumentProps> {
@@ -69,6 +53,11 @@ export default class MyDocument extends Document<DocumentProps> {
<Main />
{hydrationScript}
<NextScript />
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-60624235-5"
/>
</body>
</html>
);