-
Notifications
You must be signed in to change notification settings - Fork 870
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1853 from pt-plugins/dev_full_vite
- Loading branch information
Showing
16 changed files
with
842 additions
and
1,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/// <reference types="vite/client" /> | ||
|
||
declare module '*.vue' { | ||
import Vue from 'vue' | ||
export default Vue | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import path from 'node:path' | ||
import {defineConfig} from 'vite' | ||
import {sharedConfig} from "./vite.config"; | ||
import fs from "node:fs"; | ||
import git from 'git-rev-sync' | ||
import { nodePolyfills } from 'vite-plugin-node-polyfills' | ||
import buildResource from "./vite/buildResource"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
...sharedConfig, | ||
build: { | ||
outDir: path.resolve(__dirname, 'dist/background'), | ||
lib: { | ||
entry: path.resolve(__dirname, 'src/background/index.ts'), | ||
name: 'background', | ||
formats: ['iife'] | ||
}, | ||
rollupOptions: { | ||
output: { | ||
entryFileNames: 'index.js', | ||
extend: true, | ||
}, | ||
}, | ||
chunkSizeWarningLimit: Number.MAX_SAFE_INTEGER, | ||
emptyOutDir: false, | ||
copyPublicDir: false | ||
}, | ||
plugins: [ | ||
nodePolyfills({ | ||
include: ['path'], | ||
}), | ||
buildResource(), | ||
{ | ||
name: 'update_manifest_version', | ||
closeBundle() { | ||
const manifest_file_path = path.resolve(__dirname, './dist/manifest.json'); | ||
const manifest = JSON.parse(fs.readFileSync(manifest_file_path, 'utf-8')); | ||
const build_number = git.count() % 65535; | ||
manifest.version = `${manifest.version}.${build_number}`; | ||
|
||
fs.writeFileSync(manifest_file_path, JSON.stringify(manifest, null, 2)); | ||
}, | ||
} | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import path from 'node:path' | ||
import { defineConfig } from 'vite' | ||
import { nodePolyfills } from 'vite-plugin-node-polyfills' | ||
import {sharedConfig} from "./vite.config"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
...sharedConfig, | ||
build: { | ||
outDir: path.resolve(__dirname, 'dist/contentScripts'), | ||
lib: { | ||
entry: path.resolve(__dirname, 'src/content/index.ts'), | ||
name: 'content', | ||
formats: ['iife'] | ||
}, | ||
rollupOptions: { | ||
output: { | ||
entryFileNames: 'index.js', | ||
extend: true, | ||
}, | ||
}, | ||
chunkSizeWarningLimit: Number.MAX_SAFE_INTEGER, | ||
emptyOutDir: false, | ||
copyPublicDir: false | ||
}, | ||
plugins: [ | ||
nodePolyfills({ | ||
include: ['path'], | ||
}), | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,26 @@ | ||
import { fileURLToPath, URL } from 'node:url' | ||
import fs from 'node:fs' | ||
import path from 'node:path' | ||
import { defineConfig } from 'vite' | ||
import vue from '@vitejs/plugin-vue2' | ||
import git from 'git-rev-sync' | ||
import buildResource from "./vite/buildResource"; | ||
|
||
export const sharedConfig = { | ||
publicDir: 'public', | ||
resolve: { | ||
extensions: ['.ts', '.js', '.tsx', '.vue'], | ||
alias: { | ||
'@': fileURLToPath(new URL('src', import.meta.url)) | ||
}, | ||
}, | ||
} | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
...sharedConfig, | ||
publicDir: 'public', | ||
build: { | ||
chunkSizeWarningLimit: 0, | ||
chunkSizeWarningLimit: Number.MAX_SAFE_INTEGER, | ||
emptyOutDir: false | ||
}, | ||
plugins: [ | ||
vue(), | ||
buildResource(), | ||
{ | ||
name: 'update_manifest_version', | ||
closeBundle() { | ||
const manifest_file_path = path.resolve(__dirname, './dist/manifest.json'); | ||
const manifest = JSON.parse(fs.readFileSync(manifest_file_path, 'utf-8')); | ||
const build_number = git.count() % 65535; | ||
manifest.version = `${manifest.version}.${build_number}`; | ||
|
||
fs.writeFileSync(manifest_file_path, JSON.stringify(manifest, null, 2)); | ||
}, | ||
} | ||
], | ||
resolve: { | ||
extensions: ['.ts', '.js', '.tsx', '.vue'], | ||
alias: { | ||
'@': fileURLToPath(new URL('src', import.meta.url)) | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.