Browse Source

refactor: replaced Webpack with Vite. Not fully finished yet

Kristian Vos 3 năm trước cách đây
mục cha
commit
23075bf323

+ 2 - 3
.gitignore

@@ -27,9 +27,8 @@ backend/build
 frontend/bundle-stats.json
 frontend/bundle-report.html
 frontend/node_modules/
-frontend/dist/build/
-frontend/dist/index.html
-frontend/dist/config/default.json
+frontend/build/
+frontend/config/default.json
 
 npm
 node_modules

+ 0 - 0
frontend/dist/config/template.json → frontend/config/template.json


+ 0 - 56
frontend/dist/index.tpl.html

@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<html lang='en'>
-
-<head>
-	<title><%= htmlWebpackPlugin.options.title %></title>
-
-	<meta charset='UTF-8'>
-	<meta http-equiv='X-UA-Compatible' content='IE=edge'>
-	<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'>
-	<meta name='keywords' content='music, <%= htmlWebpackPlugin.options.title %>, musare, songs, song catalogue, listen, station, station, radio, open source'>
-	<meta name='description' content='<%= htmlWebpackPlugin.options.title %> is an open-source collaborative music listening and catalogue curation application. Currently supporting YouTube based content.'>
-	<meta name='copyright' content='© Copyright Musare 2015-2022 All Right Reserved'>
-
-	<link rel='apple-touch-icon' sizes='57x57' href='/assets/favicon/apple-touch-icon-57x57.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='60x60' href='/assets/favicon/apple-touch-icon-60x60.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='72x72' href='/assets/favicon/apple-touch-icon-72x72.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='76x76' href='/assets/favicon/apple-touch-icon-76x76.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='114x114' href='/assets/favicon/apple-touch-icon-114x114.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='120x120' href='/assets/favicon/apple-touch-icon-120x120.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='144x144' href='/assets/favicon/apple-touch-icon-144x144.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='152x152' href='/assets/favicon/apple-touch-icon-152x152.png?v=06042016'>
-	<link rel='apple-touch-icon' sizes='180x180' href='/assets/favicon/apple-touch-icon-180x180.png?v=06042016'>
-	<link rel='icon' type='image/png' href='/assets/favicon/favicon-32x32.png?v=06042016' sizes='32x32'>
-	<link rel='icon' type='image/png' href='/assets/favicon/favicon-194x194.png?v=06042016' sizes='194x194'>
-	<link rel='icon' type='image/png' href='/assets/favicon/favicon-96x96.png?v=06042016' sizes='96x96'>
-	<link rel='icon' type='image/png' href='/assets/favicon/android-chrome-192x192.png?v=06042016' sizes='192x192'>
-	<link rel='icon' type='image/png' href='/assets/favicon/favicon-16x16.png?v=06042016' sizes='16x16'>
-	<link rel='manifest' href='/assets/favicon/manifest.json?v=06042016'>
-	<link rel='mask-icon' href='/assets/favicon/safari-pinned-tab.svg?v=06042016' color='#03a9f4'>
-	<link rel='shortcut icon' href='/assets/favicon/favicon.ico?v=06042016'>
-	<meta name='msapplication-TileColor' content='#03a9f4'>
-	<meta name='msapplication-TileImage' content='/assets/favicon/mstile-144x144.png?v=06042016'>
-	<meta name='theme-color' content='#03a9f4'>
-	<meta name='google' content='nositelinkssearchbox' />
-
-	<script src='https://www.youtube.com/iframe_api'></script>
-
-	<!--Musare version: <%= htmlWebpackPlugin.options.debug.version %>-->
-	<script>
-		const MUSARE_VERSION = "<%= htmlWebpackPlugin.options.debug.version %>";
-		const MUSARE_GIT_REMOTE = "<%= htmlWebpackPlugin.options.debug.git.remote %>";
-		const MUSARE_GIT_REMOTE_URL = "<%= htmlWebpackPlugin.options.debug.git.remoteUrl %>";
-		const MUSARE_GIT_BRANCH = "<%= htmlWebpackPlugin.options.debug.git.branch %>";
-		const MUSARE_GIT_LATEST_COMMIT = "<%= htmlWebpackPlugin.options.debug.git.latestCommit %>";
-		const MUSARE_GIT_LATEST_COMMIT_SHORT = "<%= htmlWebpackPlugin.options.debug.git.latestCommitShort %>";
-	</script>
-</head>
-
-<body>
-	<div id="root"></div>
-	<div id="toasts-container" class="position-right position-bottom">
-		<div id="toasts-content"></div>
-	</div>
-</body>
-
-</html>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1873 - 2265
frontend/package-lock.json


+ 7 - 25
frontend/package.json

@@ -13,48 +13,33 @@
   "repository": "https://github.com/Musare/Musare",
   "scripts": {
     "lint": "npx eslint src --ext .js,.vue",
-    "dev": "npx webpack serve --config webpack.dev.js",
-    "prod": "npx webpack --config webpack.prod.js"
+    "dev": "npx vite",
+    "prod": "npx vite build"
   },
   "devDependencies": {
-    "@babel/core": "^7.18.2",
-    "@babel/eslint-parser": "^7.18.2",
-    "@babel/plugin-proposal-object-rest-spread": "^7.18.0",
-    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
-    "@babel/plugin-transform-runtime": "^7.18.2",
-    "@babel/preset-env": "^7.18.2",
     "@vue/compiler-sfc": "^3.2.36",
-    "babel-loader": "^8.2.5",
-    "css-loader": "^6.7.1",
     "eslint": "^8.17.0",
     "eslint-config-prettier": "^8.5.0",
     "eslint-plugin-import": "^2.26.0",
     "eslint-plugin-prettier": "^4.0.0",
     "eslint-plugin-vue": "^9.1.0",
-    "eslint-webpack-plugin": "^3.1.1",
     "fetch": "^1.1.0",
     "less": "^4.1.2",
-    "less-loader": "^11.0.0",
-    "prettier": "^2.6.2",
-    "style-loader": "^3.3.1",
-    "style-resources-loader": "^1.5.0",
-    "vue-style-loader": "^4.1.3",
-    "webpack-cli": "^4.9.2",
-    "webpack-dev-server": "^4.9.1"
+    "prettier": "^2.6.2"
   },
   "dependencies": {
-    "@babel/runtime": "^7.18.3",
+    "@vitejs/plugin-vue": "^2.3.3",
     "can-autoplay": "^3.0.2",
     "chart.js": "^3.8.0",
     "config": "^3.3.7",
     "date-fns": "^2.28.0",
     "dompurify": "^2.3.8",
     "eslint-config-airbnb-base": "^15.0.0",
-    "html-webpack-plugin": "^5.5.0",
     "lofig": "^1.3.4",
     "marked": "^4.0.16",
     "normalize.css": "^8.0.1",
     "toasters": "^2.3.1",
+    "vite": "^2.9.12",
     "vue": "^3.2.36",
     "vue-chartjs": "^4.1.1",
     "vue-content-loader": "^2.0.1",
@@ -63,9 +48,6 @@
     "vue-router": "^4.0.15",
     "vue-tippy": "^6.0.0-alpha.57",
     "vuedraggable": "^4.1.0",
-    "vuex": "^4.0.2",
-    "webpack": "^5.73.0",
-    "webpack-bundle-analyzer": "^4.5.0",
-    "webpack-merge": "^5.8.0"
+    "vuex": "^4.0.2"
   }
-}
+}

+ 138 - 0
frontend/src/index.html

@@ -0,0 +1,138 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>{{ title }}</title>
+
+		<meta charset="UTF-8" />
+		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+		<meta
+			name="viewport"
+			content="width=device-width, initial-scale=1, user-scalable=no"
+		/>
+		<meta
+			name="keywords"
+			content="music, {{ title }}, musare, songs, song catalogue, listen, station, station, radio, open source"
+		/>
+		<meta
+			name="description"
+			content="{{ title }} is an open-source collaborative music listening and catalogue curation application. Currently supporting YouTube based content."
+		/>
+		<meta
+			name="copyright"
+			content="© Copyright Musare 2015-2022 All Right Reserved"
+		/>
+
+		<link
+			rel="apple-touch-icon"
+			sizes="57x57"
+			href="/assets/favicon/apple-touch-icon-57x57.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="60x60"
+			href="/assets/favicon/apple-touch-icon-60x60.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="72x72"
+			href="/assets/favicon/apple-touch-icon-72x72.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="76x76"
+			href="/assets/favicon/apple-touch-icon-76x76.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="114x114"
+			href="/assets/favicon/apple-touch-icon-114x114.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="120x120"
+			href="/assets/favicon/apple-touch-icon-120x120.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="144x144"
+			href="/assets/favicon/apple-touch-icon-144x144.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="152x152"
+			href="/assets/favicon/apple-touch-icon-152x152.png?v=06042016"
+		/>
+		<link
+			rel="apple-touch-icon"
+			sizes="180x180"
+			href="/assets/favicon/apple-touch-icon-180x180.png?v=06042016"
+		/>
+		<link
+			rel="icon"
+			type="image/png"
+			href="/assets/favicon/favicon-32x32.png?v=06042016"
+			sizes="32x32"
+		/>
+		<link
+			rel="icon"
+			type="image/png"
+			href="/assets/favicon/favicon-194x194.png?v=06042016"
+			sizes="194x194"
+		/>
+		<link
+			rel="icon"
+			type="image/png"
+			href="/assets/favicon/favicon-96x96.png?v=06042016"
+			sizes="96x96"
+		/>
+		<link
+			rel="icon"
+			type="image/png"
+			href="/assets/favicon/android-chrome-192x192.png?v=06042016"
+			sizes="192x192"
+		/>
+		<link
+			rel="icon"
+			type="image/png"
+			href="/assets/favicon/favicon-16x16.png?v=06042016"
+			sizes="16x16"
+		/>
+		<link rel="manifest" href="/assets/favicon/manifest.json?v=06042016" />
+		<link
+			rel="mask-icon"
+			href="/assets/favicon/safari-pinned-tab.svg?v=06042016"
+			color="#03a9f4"
+		/>
+		<link
+			rel="shortcut icon"
+			href="/assets/favicon/favicon.ico?v=06042016"
+		/>
+		<meta name="msapplication-TileColor" content="#03a9f4" />
+		<meta
+			name="msapplication-TileImage"
+			content="/assets/favicon/mstile-144x144.png?v=06042016"
+		/>
+		<meta name="theme-color" content="#03a9f4" />
+		<meta name="google" content="nositelinkssearchbox" />
+
+		<script src="https://www.youtube.com/iframe_api"></script>
+
+		<!--Musare version: {{ version }}-->
+		<!--
+			Git info
+			Remote: {{ gitRemote }}
+			Remote URL: {{ gitRemoteUrl }}
+			Branch: {{ gitBranch }}
+			Latest commit: {{ gitLatestCommit }}
+			Latest commit short: {{ gitLatestCommitShort }}
+		-->
+	</head>
+
+	<body>
+		<div id="root"></div>
+		<div id="toasts-container" class="position-right position-bottom">
+			<div id="toasts-content"></div>
+		</div>
+		<script type="module" src="/main.js"></script>
+	</body>
+</html>

+ 11 - 11
frontend/src/main.js

@@ -11,9 +11,11 @@ import store from "./store";
 
 import AppComponent from "./App.vue";
 
+import defaultConfigURL from "../config/default.json?url";
+
 const REQUIRED_CONFIG_VERSION = 11;
 
-lofig.folder = "../config/default.json";
+lofig.folder = defaultConfigURL;
 
 const handleMetadata = attrs => {
 	lofig.get("siteSettings.sitename").then(siteName => {
@@ -61,16 +63,14 @@ app.component("PageMetadata", {
 	}
 });
 
-const globalComponents = require.context(
-	"@/components/global/",
-	true,
-	/\.vue$/i
+const globalComponents = import.meta.glob("@/components/global/*.vue");
+Object.entries(globalComponents).forEach(
+	async ([componentFilePath, definition]) => {
+		const componentName = componentFilePath.split("/").pop().split(".")[0];
+		const component = await definition();
+		app.component(componentName, component.default);
+	}
 );
-globalComponents.keys().forEach(componentFilePath => {
-	const componentName = componentFilePath.split("/").pop().split(".")[0];
-	const component = globalComponents(componentFilePath);
-	app.component(componentName, component.default || component);
-});
 
 app.directive("scroll", {
 	mounted(el, binding) {
@@ -274,7 +274,7 @@ router.beforeEach((to, from, next) => {
 
 app.use(router);
 
-lofig.folder = "/config/default.json";
+lofig.folder = defaultConfigURL;
 
 (async () => {
 	lofig.fetchConfig().then(config => {

+ 1 - 1
frontend/src/pages/Profile/index.vue

@@ -107,7 +107,7 @@ import ws from "@/ws";
 
 import TabQueryHandler from "@/mixins/TabQueryHandler.vue";
 
-import ProfilePicture from "@/components/ProfilePicture";
+import ProfilePicture from "@/components/ProfilePicture.vue";
 
 import RecentActivity from "./Tabs/RecentActivity.vue";
 import Playlists from "./Tabs/Playlists.vue";

+ 163 - 0
frontend/vite.config.js

@@ -0,0 +1,163 @@
+import path from "path";
+import vue from "@vitejs/plugin-vue";
+import config from "config";
+import fs from "fs";
+
+const fetchVersionAndGitInfo = () => {
+	const debug = {
+		git: {
+			remote: "",
+			remoteUrl: "",
+			branch: "",
+			latestCommit: "",
+			latestCommitShort: ""
+		},
+		version: ""
+	};
+
+	try {
+		const packageJson = JSON.parse(
+			fs.readFileSync("./package.json").toString()
+		);
+
+		console.log(`Musare version: ${packageJson.version}.`);
+		if (config.get("debug.version")) debug.version = packageJson.version;
+	} catch (e) {
+		console.log(`Could not get package info: ${e.message}.`);
+	}
+
+	try {
+		let gitFolder = null;
+		if (fs.existsSync(".parent_git/HEAD")) gitFolder = ".parent_git";
+		else if (fs.existsSync("../.git/HEAD")) gitFolder = "../.git";
+
+		if (gitFolder) {
+			const headContents = fs
+				.readFileSync(`${gitFolder}/HEAD`)
+				.toString()
+				.replace(/\n/g, "");
+			const branch = /ref: refs\/heads\/([.A-Za-z0-9_-]+)/.exec(
+				headContents
+			)[1];
+
+			const configContents = fs
+				.readFileSync(`${gitFolder}/config`)
+				.toString()
+				.replace(/\t/g, "")
+				.split("\n");
+
+			let remote;
+			let remoteUrl;
+			let latestCommit;
+			let latestCommitShort;
+
+			if (configContents.indexOf(`[branch "${branch}"]`) >= 0) {
+				remote = /remote = (.+)/.exec(
+					configContents[
+						configContents.indexOf(`[branch "${branch}"]`) + 1
+					]
+				)[1];
+
+				remoteUrl = /url = (.+)/.exec(
+					configContents[
+						configContents.indexOf(`[remote "${remote}"]`) + 1
+					]
+				)[1];
+
+				latestCommit = fs
+					.readFileSync(`${gitFolder}/refs/heads/${branch}`)
+					.toString()
+					.replace(/\n/g, "");
+
+				latestCommitShort = latestCommit.substr(0, 7);
+			}
+
+			console.log(
+				`Git branch: ${remote}/${branch}. Remote url: ${remoteUrl}. Latest commit: ${latestCommit} (${latestCommitShort}).`
+			);
+			if (config.get("debug.git.remote")) debug.git.remote = remote;
+			if (config.get("debug.git.remoteUrl"))
+				debug.git.remoteUrl = remoteUrl;
+			if (config.get("debug.git.branch")) debug.git.branch = branch;
+			if (config.get("debug.git.latestCommit"))
+				debug.git.latestCommit = latestCommit;
+			if (config.get("debug.git.latestCommitShort"))
+				debug.git.latestCommitShort = latestCommitShort;
+		}
+	} catch (e) {
+		console.log(`Could not get Git info: ${e.message}.`, e);
+	}
+
+	return debug;
+};
+
+const debug = fetchVersionAndGitInfo();
+
+const siteName = config.has("siteSettings.sitename")
+	? config.get("siteSettings.sitename")
+	: "Musare";
+
+const htmlPlugin = () => ({
+	name: "html-transform",
+	transformIndexHtml(originalHtml) {
+		let html = originalHtml;
+
+		html = html.replace(/{{ title }}/g, siteName);
+		html = html.replace(/{{ version }}/g, debug.version);
+		html = html.replace(/{{ gitRemote }}/g, debug.git.remote);
+		html = html.replace(/{{ gitRemoteUrl }}/g, debug.git.remoteUrl);
+		html = html.replace(/{{ gitBranch }}/g, debug.git.branch);
+		html = html.replace(/{{ gitLatestCommit }}/g, debug.git.latestCommit);
+		html = html.replace(
+			/{{ gitLatestCommitShort }}/g,
+			debug.git.latestCommitShort
+		);
+
+		return html;
+	}
+});
+
+const mode = process.env.FRONTEND_MODE || "development";
+
+export default {
+	mode,
+	root: "src",
+	publicDir: "../dist",
+	base: "/",
+	resolve: {
+		alias: [
+			{
+				find: "@",
+				replacement: path.resolve(__dirname, "src")
+			}
+		]
+	},
+	define: {
+		__VUE_OPTIONS_API__: true,
+		__VUE_PROD_DEVTOOLS__: false,
+		MUSARE_VERSION: JSON.stringify(debug.version),
+		MUSARE_GIT_REMOTE: JSON.stringify(debug.git.remote),
+		MUSARE_GIT_REMOTE_URL: JSON.stringify(debug.git.remoteUrl),
+		MUSARE_GIT_BRANCH: JSON.stringify(debug.git.branch),
+		MUSARE_GIT_LATEST_COMMIT: JSON.stringify(debug.git.latestCommit),
+		MUSARE_GIT_LATEST_COMMIT_SHORT: JSON.stringify(
+			debug.git.latestCommitShort
+		)
+	},
+	plugins: [vue(), htmlPlugin()],
+	css: {
+		preprocessorOptions: {
+			less: {
+				additionalData: `@import "@/styles/variables.less";`
+			}
+		}
+	},
+	server: {
+		host: "0.0.0.0",
+		port: config.get("devServer.port"),
+		strictPort: true
+	},
+	build: {
+		outDir: "../build"
+	}
+};

+ 0 - 183
frontend/webpack.common.js

@@ -1,183 +0,0 @@
-process.env.NODE_CONFIG_DIR = `${__dirname}/dist/config/`;
-const path = require("path");
-const fs = require("fs");
-const config = require("config");
-const { VueLoaderPlugin } = require("vue-loader");
-const HtmlWebpackPlugin = require("html-webpack-plugin");
-const ESLintPlugin = require("eslint-webpack-plugin");
-const { DefinePlugin } = require("webpack");
-
-const fetchVersionAndGitInfo = cb => {
-	const debug = {
-		git: {
-			remote: "",
-			remoteUrl: "",
-			branch: "",
-			latestCommit: "",
-			latestCommitShort: ""
-		},
-		version: ""
-	};
-
-	try {
-		const packageJson = JSON.parse(
-			fs.readFileSync("./package.json").toString()
-		);
-		const headContents = fs
-			.readFileSync(".parent_git/HEAD")
-			.toString()
-			.replace(/\n/g, "");
-		const branch = new RegExp("ref: refs/heads/([.A-Za-z0-9_-]+)").exec(
-			headContents
-		)[1];
-		const configContents = fs
-			.readFileSync(".parent_git/config")
-			.toString()
-			.replace(/\t/g, "")
-			.split("\n");
-		const remote = new RegExp("remote = (.+)").exec(
-			configContents[configContents.indexOf(`[branch "${branch}"]`) + 1]
-		)[1];
-		const remoteUrl = new RegExp("url = (.+)").exec(
-			configContents[configContents.indexOf(`[remote "${remote}"]`) + 1]
-		)[1];
-		const latestCommit = fs
-			.readFileSync(`.parent_git/refs/heads/${branch}`)
-			.toString()
-			.replace(/\n/g, "");
-		const latestCommitShort = latestCommit.substr(0, 7);
-
-		console.log(`Musare version: ${packageJson.version}.`);
-		console.log(
-			`Git branch: ${remote}/${branch}. Remote url: ${remoteUrl}. Latest commit: ${latestCommit} (${latestCommitShort}).`
-		);
-
-		if (config.get("debug.version")) debug.version = packageJson.version;
-		if (config.get("debug.git.remote")) debug.git.remote = remote;
-		if (config.get("debug.git.remoteUrl")) debug.git.remoteUrl = remoteUrl;
-		if (config.get("debug.git.branch")) debug.git.branch = branch;
-		if (config.get("debug.git.latestCommit"))
-			debug.git.latestCommit = latestCommit;
-		if (config.get("debug.git.latestCommitShort"))
-			debug.git.latestCommitShort = latestCommitShort;
-	} catch (e) {
-		console.log(`Could not get Git info: ${e.message}.`);
-	}
-
-	cb(debug);
-};
-
-fetchVersionAndGitInfo(() => {});
-
-class InsertDebugInfoPlugin {
-	apply(compiler) {
-		compiler.hooks.compilation.tap("InsertDebugInfoPlugin", compilation => {
-			HtmlWebpackPlugin.getHooks(
-				compilation
-			).beforeAssetTagGeneration.tapAsync(
-				"InsertDebugInfoPlugin",
-				(data, cb) => {
-					fetchVersionAndGitInfo(debug => {
-						data.plugin.userOptions.debug.version = debug.version;
-						data.plugin.userOptions.debug.git.remote =
-							debug.git.remote;
-						data.plugin.userOptions.debug.git.remoteUrl =
-							debug.git.remoteUrl;
-						data.plugin.userOptions.debug.git.branch =
-							debug.git.branch;
-						data.plugin.userOptions.debug.git.latestCommit =
-							debug.git.latestCommit;
-						data.plugin.userOptions.debug.git.latestCommitShort =
-							debug.git.latestCommitShort;
-						cb(null, data);
-					});
-				}
-			);
-		});
-	}
-}
-
-module.exports = {
-	entry: "./src/main.js",
-	output: {
-		path: `${__dirname}/dist/build/`,
-		filename: "[name].[contenthash].js"
-	},
-	resolve: {
-		alias: {
-			"@": path.resolve(__dirname, "./src/")
-		},
-		extensions: [".js", ".vue"]
-	},
-	plugins: [
-		new VueLoaderPlugin(),
-		new HtmlWebpackPlugin({
-			title: config.has("siteSettings.sitename")
-				? config.get("siteSettings.sitename")
-				: "Musare",
-			hash: true,
-			template: "dist/index.tpl.html",
-			inject: "body",
-			filename: "index.html",
-			debug: {
-				git: {
-					remote: "",
-					remoteUrl: "",
-					branch: "",
-					latestCommit: "",
-					latestCommitShort: ""
-				},
-				version: ""
-			}
-		}),
-		new ESLintPlugin(),
-		new InsertDebugInfoPlugin(),
-		new DefinePlugin({
-			__VUE_OPTIONS_API__: true,
-			__VUE_PROD_DEVTOOLS__: false
-		})
-	],
-	module: {
-		rules: [
-			{
-				test: /\.vue$/,
-				loader: "vue-loader",
-				exclude: /node_modules/
-			},
-			{
-				test: /\.js$/,
-				loader: "babel-loader",
-				exclude: /node_modules/
-			},
-			{
-				test: /\.css$/,
-				use: ["style-loader", "css-loader"]
-			},
-			{
-				test: /\.less$/i,
-				exclude: /node_modules/,
-				use: [
-					"vue-style-loader",
-					{
-						loader: "css-loader",
-						options: {
-							url: false
-						}
-					},
-					"less-loader",
-					{
-						loader: "style-resources-loader",
-						options: {
-							patterns: [
-								path.resolve(
-									__dirname,
-									"./src/styles/variables.less"
-								)
-							]
-						}
-					}
-				]
-			}
-		]
-	}
-};

+ 0 - 32
frontend/webpack.dev.js

@@ -1,32 +0,0 @@
-process.env.NODE_CONFIG_DIR = `${__dirname}/dist/config/`;
-const config = require("config");
-
-const { merge } = require("webpack-merge");
-const common = require("./webpack.common.js");
-module.exports = merge(common, {
-	mode: "development",
-	devtool: "inline-source-map",
-	output: {
-		publicPath: "/"
-	},
-	resolve: {
-		alias: {
-			styles: "src/styles",
-			vue: "vue/dist/vue.esm-bundler.js"
-		}
-	},
-	devServer: {
-		static: {
-			directory: "./dist/",
-			watch: true
-		},
-		client: {
-			webSocketURL: config.get("devServer.webSocketURL")
-		},
-		hot: true,
-		historyApiFallback: true,
-		port: config.get("devServer.port"),
-		host: "0.0.0.0",
-		allowedHosts: "all"
-	}
-});

+ 0 - 49
frontend/webpack.prod.js

@@ -1,49 +0,0 @@
-const { merge } = require("webpack-merge");
-const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
-
-const common = require("./webpack.common.js");
-
-module.exports = merge(common, {
-	mode: "production",
-	devtool: "source-map",
-	output: {
-		publicPath: "/build/"
-	},
-	resolve: {
-		alias: {
-			styles: "src/styles",
-			vue: "vue/dist/vue.esm-bundler.js"
-		}
-	},
-	plugins: [
-		new BundleAnalyzerPlugin({
-			analyzerMode: "static"
-		})
-	],
-	optimization: {
-		runtimeChunk: "single",
-		splitChunks: {
-			cacheGroups: {
-				commons: {
-					name: "vendors",
-					test: /[\\/]node_modules[\\/](vue|vuex|vue-router)[\\/]/,
-					chunks: "all"
-				},
-				ui: {
-					name: false,
-					test(module) {
-						return module.resource && (
-							module.resource.includes("Modal.vue") ||
-							module.resource.includes(
-								"AddToPlaylistDropdown.vue"
-							) ||
-							module.resource.includes("MainHeader.vue") ||
-							module.resource.includes("MainFooter.vue")
-						);
-					},
-					enforce: true
-				}
-			}
-		}
-	}
-});

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác