refactoring, split webpack configs + get rid of electron-webpack

This commit is contained in:
Roman committed 2020-06-12 22:23:15 +03:00
1 parent a4d66fffda
commit 9aa815bc14
18 files changed
+407 -1329

No files matched your search

@@ -28,16 +28,17 @@
<script>
import marked from 'marked'
import fs from 'fs'
import path from "path"
import {readFileSync} from 'fs'
import { getStaticPath } from "../../../common/register-static"
export default {
name: 'WhatsNewPage',
data() {
let releaseNotes = getStaticPath("RELEASE_NOTES.md");
let content = marked(readFileSync(releaseNotes, 'utf8'));
return {
error: "",
// eslint-disable-next-line
content: marked(fs.readFileSync(path.join(__static, "RELEASE_NOTES.md"), 'utf8')),
content: content,
}
},
components: {},
+4 -2
View File
@@ -1,8 +1,10 @@
// Renderer process
import "../common/system-ca"
import { App } from "./components/app";
// import { App } from "./components/app";
// import { appInitVue } from "./_vue";
// appInitVue()
// App.init();
App.init();
var app = document.getElementById("app")
app.innerHTML = "RUNNING!!"
+1 -2
View File
@@ -3,8 +3,7 @@
<head>
<meta charset="UTF-8">
<title>Lens - The Kubernetes IDE</title>
<!-- <meta name="viewport" content="width=device-width, initial-scale=1">-->
<!-- <meta http-equiv="Content-Security-Policy" content="script-src 'self'">-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
</head>
<body>
-46
View File
@@ -1,46 +0,0 @@
// fixme: convert to typescript (support webpack types, reuse vars.ts)
const path = require("path");
module.exports = function (config, env) {
const {module} = config;
const {rules} = module;
// localization support
// https://lingui.js.org/guides/typescript.html
patchLoader(".tsx", "ts-loader", loader => {
loader.options = Object.assign({}, loader.options, {
compilerOptions: {
jsx: "preserve", // @lingui/babel-preset-react
target: "es2016", // @lingui/babel-preset-react
}
})
return ["babel-loader", loader]
});
// sass common vars file import
patchLoader(".scss", "sass-loader", loader => {
loader.options = Object.assign({}, loader.options, {
prependData: '@import "vars.scss";',
sassOptions: {
includePaths: [
path.resolve(__dirname, "components")
]
}
})
return loader;
});
function patchLoader(fileType, loaderName, updater) {
let rule = rules.find(rule => fileType.match(rule.test));
if (rule) {
let loaders = [rule.use].flat();
let index = loaders.findIndex(loader => loader === loaderName || loader.loader === loaderName);
let loader = typeof loaders[index] === "string" ? {loader: loaders[index]} : loaders[index];
loaders[index] = updater(loader);
rule.use = loaders.flat();
console.info(`Patched webpack's renderer config for "${loaderName}" in ${__filename}`, loader);
}
}
return config;
}