From 11d0f0e7875f071b2f8bdaedbc7adfbc57669f4d Mon Sep 17 00:00:00 2001 From: Tushar Pandey Date: Sun, 15 Sep 2024 21:24:28 +0530 Subject: [PATCH] remove rollup-plugin-livereload, use rollup-plugin-dev for autoreload --- package-lock.json | 79 ++++++++++++----------------------------------- package.json | 4 +-- rollup.config.js | 26 ++++++++-------- 3 files changed, 35 insertions(+), 74 deletions(-) diff --git a/package-lock.json b/package-lock.json index 34e76e685..9e471dba8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,8 +41,8 @@ "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-dev": "^1.1.3", - "rollup-plugin-livereload": "^2.0.5", "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-serve": "^1.1.1", "rollup-plugin-sourcemaps": "^0.6.3", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.36.0", @@ -9488,28 +9488,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/livereload": { - "version": "0.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "chokidar": "^3.5.0", - "livereload-js": "^3.3.1", - "opts": ">= 1.2.0", - "ws": "^7.4.3" - }, - "bin": { - "livereload": "bin/livereload.js" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/livereload-js": { - "version": "3.3.3", - "dev": true, - "license": "MIT" - }, "node_modules/load-json-file": { "version": "1.1.0", "dev": true, @@ -10621,6 +10599,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true, + "bin": { + "opener": "bin/opener-bin.js" + } + }, "node_modules/optionator": { "version": "0.9.3", "dev": true, @@ -10637,11 +10624,6 @@ "node": ">= 0.8.0" } }, - "node_modules/opts": { - "version": "2.0.2", - "dev": true, - "license": "BSD-2-Clause" - }, "node_modules/ospath": { "version": "1.2.2", "dev": true, @@ -11927,17 +11909,6 @@ "ms": "^2.1.2" } }, - "node_modules/rollup-plugin-livereload": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "livereload": "^0.9.1" - }, - "engines": { - "node": ">=8.3" - } - }, "node_modules/rollup-plugin-node-resolve": { "version": "5.2.0", "dev": true, @@ -11953,6 +11924,16 @@ "rollup": ">=1.11.0" } }, + "node_modules/rollup-plugin-serve": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-serve/-/rollup-plugin-serve-1.1.1.tgz", + "integrity": "sha512-H0VarZRtFR0lfiiC9/P8jzCDvtFf1liOX4oSdIeeYqUCKrmFA7vNiQ0rg2D+TuoP7leaa/LBR8XBts5viF6lnw==", + "dev": true, + "dependencies": { + "mime": "^2", + "opener": "1" + } + }, "node_modules/rollup-plugin-sourcemaps": { "version": "0.6.3", "dev": true, @@ -14472,26 +14453,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/ws": { - "version": "7.5.7", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/xdg-basedir": { "version": "4.0.0", "dev": true, diff --git a/package.json b/package.json index 8c8e257ce..b2ae31134 100644 --- a/package.json +++ b/package.json @@ -64,13 +64,13 @@ "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-dev": "^1.1.3", - "rollup-plugin-livereload": "^2.0.5", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-sourcemaps": "^0.6.3", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.36.0", "rollup-plugin-visualizer": "^5.7.1", "rollup-plugin-web-worker-loader": "^1.6.1", + "rollup-plugin-serve": "^1.1.1", "serve": "^14.0.1", "ts-jest": "^28.0.8", "tslib": "^2.4.0", @@ -118,4 +118,4 @@ "pre-commit": "pretty-quick --staged" } } -} +} \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index 9dde40571..966052cdd 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,7 +3,6 @@ import commonjs from 'rollup-plugin-commonjs'; import typescript from 'rollup-plugin-typescript2'; import { terser } from 'rollup-plugin-terser'; import sourcemaps from 'rollup-plugin-sourcemaps'; -import livereload from 'rollup-plugin-livereload'; import visualizer from 'rollup-plugin-visualizer'; import webWorkerLoader from 'rollup-plugin-web-worker-loader'; import replace from '@rollup/plugin-replace'; @@ -54,10 +53,10 @@ const getPlugins = shouldMinify => { shouldMinify ? terser() : terser({ - compress: false, - mangle: false, - format: { beautify: true } - }), + compress: false, + mangle: false, + format: { beautify: true } + }), sourcemaps() ]; }; @@ -92,14 +91,15 @@ let bundles = [ plugins: [ ...getPlugins(false), !isProduction && - dev({ - dirs: ['dist', 'static'], - port: serverPort, - extend(app, modules) { - app.use(modules.mount(createApp({ port: serverPort }))); - } - }), - !isProduction && livereload() + dev({ + dirs: ['dist', 'static'], + port: serverPort, + extend(app, modules) { + app.use(modules.mount(createApp({ port: serverPort }))); + }, + spa: true, + force: true + }) ], watch: { clearScreen: false