mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
feat: remove sourcemaps from production build, add to new development build
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
"build:chrome": "cross-env MODE=chrome vite build",
|
"build:chrome": "cross-env MODE=chrome vite build",
|
||||||
"build:firefox": "cross-env MODE=firefox vite build",
|
"build:firefox": "cross-env MODE=firefox vite build",
|
||||||
"build:safari": "cross-env MODE=safari vite build",
|
"build:safari": "cross-env MODE=safari vite build",
|
||||||
|
"build:dev": "cross-env MODE=chrome vite build --config vite-dev.config.ts && cross-env MODE=firefox vite build --config vite-dev.config.ts",
|
||||||
"convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --app-name $npm_package_name-safari",
|
"convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --app-name $npm_package_name-safari",
|
||||||
"dependency-graph": "depcruise src --include-only \"^src\" --output-type dot | dot -T svg > dependency-graph.svg",
|
"dependency-graph": "depcruise src --include-only \"^src\" --output-type dot | dot -T svg > dependency-graph.svg",
|
||||||
"release": "gh release create $npm_package_name@$npm_package_version ./dist/*.zip --generate-notes",
|
"release": "gh release create $npm_package_name@$npm_package_version ./dist/*.zip --generate-notes",
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import { join, resolve } from 'path';
|
||||||
|
|
||||||
|
import { updateManifestPlugin } from './lib/patchPackage';
|
||||||
|
import { base64Loader } from './lib/base64loader';
|
||||||
|
import type { BuildTarget } from './lib/types';
|
||||||
|
import ClosePlugin from './lib/closePlugin';
|
||||||
|
|
||||||
|
import react from '@vitejs/plugin-react';
|
||||||
|
import million from "million/compiler";
|
||||||
|
//import MillionLint from '@million/lint';
|
||||||
|
|
||||||
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||||
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
|
|
||||||
|
import { chrome } from './src/manifests/chrome';
|
||||||
|
import { brave } from './src/manifests/brave';
|
||||||
|
import { edge } from './src/manifests/edge';
|
||||||
|
import { firefox } from './src/manifests/firefox';
|
||||||
|
import { opera } from './src/manifests/opera';
|
||||||
|
import { safari } from './src/manifests/safari';
|
||||||
|
import { crx } from '@crxjs/vite-plugin';
|
||||||
|
|
||||||
|
const targets: BuildTarget[] = [
|
||||||
|
chrome, brave, edge, firefox, opera, safari
|
||||||
|
]
|
||||||
|
|
||||||
|
const mode = process.env.MODE || 'chrome';
|
||||||
|
|
||||||
|
export default defineConfig(({ command }) => ({
|
||||||
|
plugins: [
|
||||||
|
base64Loader,
|
||||||
|
react(),
|
||||||
|
tailwindcss(),
|
||||||
|
svelte({
|
||||||
|
emitCss: false
|
||||||
|
}),
|
||||||
|
million.vite({ auto: true }),
|
||||||
|
//MillionLint.vite(), /* enable for testing and debugging performance */
|
||||||
|
crx({
|
||||||
|
manifest: targets.find(t => t.browser === mode.toLowerCase())?.manifest ?? chrome.manifest,
|
||||||
|
browser: mode.toLowerCase() === "firefox" ? "firefox" : "chrome"
|
||||||
|
}),
|
||||||
|
updateManifestPlugin(),
|
||||||
|
...(command === 'build' ? [ClosePlugin()] : [])
|
||||||
|
],
|
||||||
|
root: resolve(__dirname, './src'),
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': resolve(__dirname, './src')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 5173,
|
||||||
|
hmr: {
|
||||||
|
host: "localhost",
|
||||||
|
protocol: "ws",
|
||||||
|
port: 5173
|
||||||
|
}
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
preprocessorOptions: {
|
||||||
|
scss: {
|
||||||
|
api: 'modern'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
optimizeDeps: {
|
||||||
|
include: ['@babel/runtime/helpers/extends', '@babel/runtime/helpers/interopRequireDefault'],
|
||||||
|
},
|
||||||
|
legacy: {
|
||||||
|
skipWebSocketTokenCheck: true,
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
outDir: resolve(__dirname, 'dist', mode),
|
||||||
|
emptyOutDir: false,
|
||||||
|
minify: false,
|
||||||
|
sourcemap: "inline",
|
||||||
|
rollupOptions: {
|
||||||
|
input: {
|
||||||
|
settings: join(__dirname, 'src', 'interface', 'index.html'),
|
||||||
|
migration: join(__dirname, 'src', 'seqta', 'utils', 'migration', 'migrate.html'),
|
||||||
|
pageState: join(__dirname, 'src', 'pageState.js'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
@@ -75,7 +75,6 @@ export default defineConfig(({ command }) => ({
|
|||||||
outDir: resolve(__dirname, 'dist', mode),
|
outDir: resolve(__dirname, 'dist', mode),
|
||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
minify: false,
|
minify: false,
|
||||||
sourcemap: "inline",
|
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
settings: join(__dirname, 'src', 'interface', 'index.html'),
|
settings: join(__dirname, 'src', 'interface', 'index.html'),
|
||||||
|
|||||||
Reference in New Issue
Block a user