feat(static): use webpack instead of vite
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
href="/static/gallery.css?v={{version}}">
|
href="/static/gallery.css?v={{version}}">
|
||||||
<script type="module"
|
<script type="module"
|
||||||
src="/static/gallery.es.js?v={{version}}"></script>
|
src="/static/gallery.js?v={{version}}"></script>
|
||||||
<link rel="icon"
|
<link rel="icon"
|
||||||
href="/favicon.ico?v={{version}}"
|
href="/favicon.ico?v={{version}}"
|
||||||
type="image/x-icon">
|
type="image/x-icon">
|
||||||
|
|||||||
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "gallery",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
1
package.json
Normal file
1
package.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
2556
static/package-lock.json
generated
2556
static/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,7 @@
|
|||||||
"name": "gallery",
|
"name": "gallery",
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "webpack"
|
||||||
"dev": "vite build --watch"
|
|
||||||
},
|
},
|
||||||
"author": "shmyga <shmyga.z@gmail.com>",
|
"author": "shmyga <shmyga.z@gmail.com>",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
@@ -12,10 +11,21 @@
|
|||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"bootstrap": "^5.3.8",
|
"bootstrap": "^5.3.8",
|
||||||
"bootstrap-icons": "^1.13.1",
|
"bootstrap-icons": "^1.13.1",
|
||||||
"flag-icons": "^7.5.0",
|
"flag-icons": "^7.5.0"
|
||||||
"sass": "^1.99.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "^8.0.9"
|
"@types/node": "^26.1.0",
|
||||||
|
"copy-webpack-plugin": "^14.0.0",
|
||||||
|
"css-loader": "^7.1.4",
|
||||||
|
"file-loader": "^6.2.0",
|
||||||
|
"mini-css-extract-plugin": "^2.10.2",
|
||||||
|
"sass": "^1.101.0",
|
||||||
|
"sass-loader": "^17.0.0",
|
||||||
|
"style-loader": "^4.0.0",
|
||||||
|
"ts-loader": "^9.6.2",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"typescript": "^6.0.3",
|
||||||
|
"webpack": "^5.108.3",
|
||||||
|
"webpack-cli": "^7.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as bootstrap from "bootstrap";
|
import * as bootstrap from "bootstrap";
|
||||||
import "./components";
|
import "./components";
|
||||||
import "./language";
|
import "./language";
|
||||||
import "./main.scss";
|
//import "./main.scss";
|
||||||
import "./theme";
|
import "./theme";
|
||||||
import "./weather/weather";
|
import "./weather/weather";
|
||||||
import "./schedule/schedule";
|
import "./schedule/schedule";
|
||||||
|
|||||||
14
static/tsconfig.json
Normal file
14
static/tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "./src",
|
||||||
|
"outDir": "./dist/",
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"target": "esnext",
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"allowJs": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import { defineConfig } from "vite";
|
|
||||||
import packageJson from "./package.json";
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
base: "./",
|
|
||||||
build: {
|
|
||||||
outDir: "./dist",
|
|
||||||
lib: {
|
|
||||||
entry: "./src/index.ts",
|
|
||||||
name: packageJson.name,
|
|
||||||
fileName: (format) => `${packageJson.name}.${format}.js`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
69
static/webpack.config.ts
Normal file
69
static/webpack.config.ts
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import CopyPlugin from "copy-webpack-plugin";
|
||||||
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
import webpack from "webpack";
|
||||||
|
import packageInfo from "./package.json" with { type: "json" };
|
||||||
|
|
||||||
|
// in case you run into any TypeScript error when configuring `devServer`
|
||||||
|
//import "webpack-dev-server";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
const config: webpack.Configuration = {
|
||||||
|
entry: ["./src/index.ts", "./src/main.scss"],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{ test: /\.svg$/, use: ["file-loader"] },
|
||||||
|
{
|
||||||
|
test: /\.tsx?$/,
|
||||||
|
use: {
|
||||||
|
loader: "ts-loader",
|
||||||
|
options: {
|
||||||
|
transpileOnly: true, // TODO: fix errors
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exclude: /node_modules/,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.s[ac]ss$/i,
|
||||||
|
use: [
|
||||||
|
MiniCssExtractPlugin.loader,
|
||||||
|
{ loader: "css-loader", options: { sourceMap: true, url: false } },
|
||||||
|
{ loader: "sass-loader", options: { sourceMap: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: [".tsx", ".ts", ".js"],
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: `${packageInfo.name}.js`,
|
||||||
|
path: path.resolve(__dirname, "dist"),
|
||||||
|
clean: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new MiniCssExtractPlugin({ filename: `${packageInfo.name}.css` }),
|
||||||
|
new CopyPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: "./src/**/*.svg",
|
||||||
|
//to: "[path][name].[contenthash][ext]",
|
||||||
|
to: "svg/[name][ext]",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "./node_modules/bootstrap-icons/icons/*.svg",
|
||||||
|
to: "bootstrap-icons/icons/[name][ext]",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "./node_modules/flag-icons/flags/1x1/*.svg",
|
||||||
|
to: "flag-icons/flags/1x1/[name][ext]",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
Reference in New Issue
Block a user