mirror of
https://github.com/JosunLP/BrowserExtensionTemplate.git
synced 2025-06-21 18:11:08 +00:00
adding vite
This commit is contained in:
parent
43b2d8c82b
commit
693a8da648
7 changed files with 93 additions and 95 deletions
22
package.json
22
package.json
|
@ -6,7 +6,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"deploy-v3": "npm run build-tooling && node ./tools/deploy.js && npm run sync && npm run build-js && npm run build-css && node ./tools/clean.js",
|
"deploy-v3": "npm run build-tooling && node ./tools/deploy.js && npm run sync && npm run build-js && npm run build-css && node ./tools/clean.js",
|
||||||
"deploy-v2": "npm run deploy-v3 && node ./tools/v2.js",
|
"deploy-v2": "npm run deploy-v3 && node ./tools/v2.js",
|
||||||
"build-js": "webpack --config ./webpack.config.cjs && webpack --config ./webpack.config.settings.cjs && webpack --config ./webpack.config.background.cjs",
|
"build-js": "vite build --config ./vite.config.js && vite build --config ./vite.config.settings.js && vite build --config ./vite.config.background.js",
|
||||||
"build-css": "sass ./src/sass/:./dist/css/",
|
"build-css": "sass ./src/sass/:./dist/css/",
|
||||||
"build-tooling": "tsc --project ./tooling.tsconfig.json",
|
"build-tooling": "tsc --project ./tooling.tsconfig.json",
|
||||||
"watch-ts": "tsc -w -p tsconfig.json",
|
"watch-ts": "tsc -w -p tsconfig.json",
|
||||||
|
@ -14,14 +14,14 @@
|
||||||
"sync": "npm run build-tooling && node ./tools/syncConfig.js"
|
"sync": "npm run build-tooling && node ./tools/syncConfig.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chrome": "^0.0.206",
|
"@types/chrome": "^0.0.268",
|
||||||
"@types/node": "^18.11.18",
|
"@types/node": "^20.13.0",
|
||||||
"@webcomponents/webcomponentsjs": "^2.7.0",
|
"@webcomponents/webcomponentsjs": "^2.8.0",
|
||||||
"sass": "^1.39.0",
|
"sass": "^1.77.4",
|
||||||
"ts-loader": "^9.4.2",
|
"ts-loader": "^9.5.1",
|
||||||
"typescript": "^4.2.4",
|
"typescript": "^5.4.5",
|
||||||
"webpack": "^5.75.0",
|
"vite": "^5.2.12",
|
||||||
"webpack-cli": "^5.0.1"
|
"vite-tsconfig-paths": "^4.3.2"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"> 1%",
|
"> 1%",
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
"url": "https://github.com/JosunLP/BrowserExtensionTemplate/issues"
|
"url": "https://github.com/JosunLP/BrowserExtensionTemplate/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webcomponents/custom-elements": "^1.5.1",
|
"@webcomponents/custom-elements": "^1.6.0",
|
||||||
"bootstrap": "^5.2.3"
|
"bootstrap": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
24
vite.config.background.js
Normal file
24
vite.config.background.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import { resolve } from "path";
|
||||||
|
import tsconfigPaths from "vite-tsconfig-paths";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
input: resolve(__dirname, "src/background.ts"),
|
||||||
|
output: {
|
||||||
|
entryFileNames: "background.js",
|
||||||
|
dir: resolve(__dirname, "dist/js"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
plugins: [tsconfigPaths()],
|
||||||
|
resolve: {
|
||||||
|
extensions: [".tsx", ".ts"],
|
||||||
|
},
|
||||||
|
esbuild: {
|
||||||
|
include: /.*\.tsx?$/,
|
||||||
|
exclude: [/node_modules/, /dist/, /src\/app\.ts/, /src\/settings\.ts/],
|
||||||
|
},
|
||||||
|
});
|
29
vite.config.js
Normal file
29
vite.config.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import { resolve } from "path";
|
||||||
|
import tsconfigPaths from "vite-tsconfig-paths";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
input: resolve(__dirname, "src/app.ts"),
|
||||||
|
output: {
|
||||||
|
entryFileNames: "app.js",
|
||||||
|
dir: resolve(__dirname, "dist/js"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
plugins: [tsconfigPaths()],
|
||||||
|
resolve: {
|
||||||
|
extensions: [".tsx", ".ts"],
|
||||||
|
},
|
||||||
|
esbuild: {
|
||||||
|
include: /.*\.tsx?$/,
|
||||||
|
exclude: [
|
||||||
|
/node_modules/,
|
||||||
|
/dist/,
|
||||||
|
/src\/background\.ts/,
|
||||||
|
/src\/settings\.ts/,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
29
vite.config.settings.js
Normal file
29
vite.config.settings.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import { resolve } from "path";
|
||||||
|
import tsconfigPaths from "vite-tsconfig-paths";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
input: resolve(__dirname, "src/settings.ts"),
|
||||||
|
output: {
|
||||||
|
entryFileNames: "settings.js",
|
||||||
|
dir: resolve(__dirname, "dist/js"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
plugins: [tsconfigPaths()],
|
||||||
|
resolve: {
|
||||||
|
extensions: [".tsx", ".ts"],
|
||||||
|
},
|
||||||
|
esbuild: {
|
||||||
|
include: /.*\.tsx?$/,
|
||||||
|
exclude: [
|
||||||
|
/node_modules/,
|
||||||
|
/dist/,
|
||||||
|
/src\/background\.ts/,
|
||||||
|
/src\/app\.ts/,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,28 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: './src/background.ts',
|
|
||||||
mode: 'production',
|
|
||||||
devtool: 'source-map',
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
|
||||||
use: 'ts-loader',
|
|
||||||
exclude: [
|
|
||||||
"/node_modules/",
|
|
||||||
"/dist/",
|
|
||||||
"/src/app.ts",
|
|
||||||
"/src/settings.ts"
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.tsx', '.ts'],
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: 'background.js',
|
|
||||||
path: path.resolve(__dirname, 'dist/js'),
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,28 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: './src/app.ts',
|
|
||||||
mode: 'production',
|
|
||||||
devtool: 'source-map',
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
|
||||||
use: 'ts-loader',
|
|
||||||
exclude: [
|
|
||||||
"/node_modules/",
|
|
||||||
"/dist/",
|
|
||||||
"/src/background.ts",
|
|
||||||
"/src/settings.ts"
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.tsx', '.ts'],
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: 'app.js',
|
|
||||||
path: path.resolve(__dirname, 'dist/js'),
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,28 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: './src/settings.ts',
|
|
||||||
mode: 'production',
|
|
||||||
devtool: 'source-map',
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
|
||||||
use: 'ts-loader',
|
|
||||||
exclude: [
|
|
||||||
"/node_modules/",
|
|
||||||
"/dist/",
|
|
||||||
"/src/background.ts",
|
|
||||||
"/src/app.ts"
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.tsx', '.ts'],
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: 'settings.js',
|
|
||||||
path: path.resolve(__dirname, 'dist/js'),
|
|
||||||
},
|
|
||||||
};
|
|
Loading…
Add table
Reference in a new issue