1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

vue-loader tweaks, part 1

This commit is contained in:
Roman 2020-06-13 18:47:10 +03:00
parent 4853e73d8b
commit 3458934f99
8 changed files with 38 additions and 14 deletions

View File

@ -290,6 +290,7 @@
"vue-loader": "^15.9.2", "vue-loader": "^15.9.2",
"vue-prism-editor": "^0.6.1", "vue-prism-editor": "^0.6.1",
"vue-router": "^3.3.2", "vue-router": "^3.3.2",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11",
"vuedraggable": "^2.23.2", "vuedraggable": "^2.23.2",
"vuex": "^3.4.0", "vuex": "^3.4.0",

View File

@ -1,8 +1,8 @@
@import 'custom'; @import 'custom';
@import 'fonts'; @import "~typeface-roboto/index.css";
@import '../../../../../node_modules/bootstrap/scss/bootstrap'; @import "~material-design-icons/iconfont/material-icons.css";
@import '../../../../../node_modules/bootstrap-vue/src/index'; @import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/src/index';
html, body { html, body {
margin: 0; margin: 0;

View File

@ -1,2 +0,0 @@
@import "../../../../../node_modules/typeface-roboto/index.css";
@import "../../../../../node_modules/material-design-icons/iconfont/material-icons.css";

View File

@ -1,6 +1,6 @@
// Custom fonts // Custom fonts
@import "../../../node_modules/material-design-icons/iconfont/material-icons.css"; @import "~material-design-icons/iconfont/material-icons.css";
@import "../../../node_modules/typeface-roboto/index.css"; @import "~typeface-roboto/index.css";
// Patched RobotoMono font with icons // Patched RobotoMono font with icons
// RobotoMono Windows Compatible for using in terminal // RobotoMono Windows Compatible for using in terminal

View File

@ -1,5 +1,5 @@
//-- Mixins for adaptive layout (media queries) //-- Mixins for adaptive layout (media queries)
@import "../../../node_modules/include-media/dist/include-media"; @import "~include-media/dist/include-media";
@mixin mobile { @mixin mobile {
@include media("<=desktop") { @include media("<=desktop") {

View File

@ -1,6 +1,6 @@
// Renderer process // Renderer process
import "../common/system-ca" import "../common/system-ca"
import { App } from "./components/app"; import { appInitVue } from "./_vue";
App.init(); appInitVue();

View File

@ -7,6 +7,7 @@ import { isDevelopment, isProduction, outDir, rendererDir } from "./src/common/v
import { libraryTarget, manifestPath } from "./webpack.dll"; import { libraryTarget, manifestPath } from "./webpack.dll";
export default function (): webpack.Configuration { export default function (): webpack.Configuration {
const VueLoaderPlugin = require("vue-loader/lib/plugin");
const htmlTemplate = path.resolve(rendererDir, "index.html"); const htmlTemplate = path.resolve(rendererDir, "index.html");
const sassCommonVars = path.resolve(rendererDir, "components/vars.scss"); const sassCommonVars = path.resolve(rendererDir, "components/vars.scss");
const tsConfigFile = path.resolve("tsconfig.json"); const tsConfigFile = path.resolve("tsconfig.json");
@ -26,9 +27,13 @@ export default function (): webpack.Configuration {
chunkFilename: 'chunks/[name].js', chunkFilename: 'chunks/[name].js',
}, },
resolve: { resolve: {
alias: {
"@": rendererDir,
},
extensions: [ extensions: [
'.js', '.jsx', '.json', '.js', '.jsx', '.json',
'.ts', '.tsx', '.vue' '.ts', '.tsx',
'.vue',
] ]
}, },
optimization: { optimization: {
@ -54,15 +59,20 @@ export default function (): webpack.Configuration {
test: /\.node$/, test: /\.node$/,
use: "node-loader" use: "node-loader"
}, },
{
test: /\.jsx?$/,
use: "babel-loader"
},
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
exclude: /node_modules/,
use: [ use: [
"babel-loader", "babel-loader",
{ {
loader: "ts-loader", loader: "ts-loader",
options: { options: {
// transpileOnly: false, // transpileOnly: false,
// appendTsSuffixTo: [/\.vue$/], // todo: remove after migration vue parts // appendTsSuffixTo: [/\.vue$/],
configFile: tsConfigFile, configFile: tsConfigFile,
compilerOptions: { compilerOptions: {
// localization support // localization support
@ -74,6 +84,19 @@ export default function (): webpack.Configuration {
} }
] ]
}, },
{
test: /\.vue$/,
use: {
loader: "vue-loader",
options: {
shadowMode: false,
loaders: {
sass: "vue-style-loader!css-loader!sass-loader?indentedSyntax=1",
scss: "vue-style-loader!css-loader!sass-loader",
}
}
}
},
{ {
test: /\.(jpg|png|svg|map|ico)$/, test: /\.(jpg|png|svg|map|ico)$/,
use: 'file-loader?name=assets/[name]-[hash:6].[ext]' use: 'file-loader?name=assets/[name]-[hash:6].[ext]'
@ -110,6 +133,8 @@ export default function (): webpack.Configuration {
}, },
plugins: [ plugins: [
new VueLoaderPlugin(), // todo: remove with _"vue/*"
// todo: check if this actually works in mode=production files // todo: check if this actually works in mode=production files
new webpack.DllReferencePlugin({ new webpack.DllReferencePlugin({
context: process.cwd(), context: process.cwd(),

View File

@ -11249,7 +11249,7 @@ vue-router@^3.3.2:
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.3.2.tgz#0099de402edb2fe92f9711053ab5a2156f239cad" resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.3.2.tgz#0099de402edb2fe92f9711053ab5a2156f239cad"
integrity sha512-5sEbcfb7MW8mY8lbUVbF4kgcipGXsagkM/X+pb6n0MhjP+RorWIUTPAPSqgPaiPOxVCXgAItBl8Vwz8vq78faA== integrity sha512-5sEbcfb7MW8mY8lbUVbF4kgcipGXsagkM/X+pb6n0MhjP+RorWIUTPAPSqgPaiPOxVCXgAItBl8Vwz8vq78faA==
vue-style-loader@^4.1.0: vue-style-loader@^4.1.0, vue-style-loader@^4.1.2:
version "4.1.2" version "4.1.2"
resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8" resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8"
integrity sha512-0ip8ge6Gzz/Bk0iHovU9XAUQaFt/G2B61bnWa2tCcqqdgfHs1lF9xXorFbE55Gmy92okFT+8bfmySuUOu13vxQ== integrity sha512-0ip8ge6Gzz/Bk0iHovU9XAUQaFt/G2B61bnWa2tCcqqdgfHs1lF9xXorFbE55Gmy92okFT+8bfmySuUOu13vxQ==