diff --git a/.gitignore b/.gitignore index 9d574f4..265f50c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ pnpm-debug.log* lerna-debug.log* node_modules +dist dist-ssr *.local @@ -21,6 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? -dist package-lock.json \ No newline at end of file diff --git a/src/index.html b/index.html similarity index 51% rename from src/index.html rename to index.html index 35c76ae..19e63eb 100644 --- a/src/index.html +++ b/index.html @@ -1,15 +1,16 @@ - - - - - - + + + React Big Schedule + + + -
+
+ diff --git a/package.json b/package.json index ad58e79..d1f81a9 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "README.md", "License" ], + "type": "module", "main": "dist/index.js", "homepage": "https://react-big-schedule.vercel.app", "repository": { @@ -52,45 +53,42 @@ "registry": "https://registry.npmjs.org/" }, "scripts": { - "build": "node scripts/build.js", - "start": "webpack serve --mode development --config ./webpack/webpack.dev.config.js", + "start": "vite", + "build": "vite build", + "build-lib": "node scripts/build.cjs", "clean": "rimraf ./dist && mkdir dist", - "lint": "eslint ./src", - "fix": "eslint ./" + "lint": "eslint ./src" }, "dependencies": { "@ant-design/icons": "^5.5.1", - "antd": "^5.21.2", + "@babel/cli": "^7.25.7", + "antd": "^5.21.3", "dayjs": "^1.11.13", "prop-types": "^15.8.1", "react": "^18.3.1", "react-dnd": "^14.0.5", "react-dnd-html5-backend": "^14.1.0", "react-dom": "^18.3.1", - "react-router-dom": "^6.26.2", + "react-router-dom": "^6.27.0", "rrule": "^2.8.1" }, "devDependencies": { - "@babel/cli": "^7.25.7", - "@babel/core": "^7.25.7", - "@babel/eslint-parser": "^7.25.7", - "@babel/preset-env": "^7.25.7", + "@babel/core": "^7.25.8", + "@babel/preset-env": "^7.25.8", "@babel/preset-react": "^7.25.7", - "babel-loader": "^9.2.1", - "copy-webpack-plugin": "^12.0.2", - "css-loader": "^7.1.2", + "@eslint/js": "^9.11.1", + "@types/react": "^18.3.10", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.2", + "babel-plugin-transform-runtime": "^6.23.0", "eslint": "^8.2.0", "eslint-config-airbnb": "^19.0.4", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.1", "eslint-plugin-react-hooks": "^4.6.2", - "eslint-webpack-plugin": "^4.2.0", "fs-extra": "^11.2.0", - "html-webpack-plugin": "^5.6.0", - "style-loader": "^4.0.0", - "webpack": "^5.95.0", - "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.1.0" + "globals": "^15.9.0", + "vite": "^5.4.8" } } diff --git a/scripts/build.js b/scripts/build.cjs similarity index 100% rename from scripts/build.js rename to scripts/build.cjs diff --git a/src/examples/components/Header.jsx b/src/examples/components/Header.jsx index 9d3636f..1cd6b94 100644 --- a/src/examples/components/Header.jsx +++ b/src/examples/components/Header.jsx @@ -3,17 +3,20 @@ import { Col, Row } from 'antd'; import React from 'react'; import { Link } from 'react-router-dom'; +import logo from '/logo.png'; +import npm from '/npm.svg'; + function Header() { return ( - Logo + Logo - npm-logo + npm-logo diff --git a/src/examples/index.jsx b/src/examples/index.jsx index 5a99f91..f6f6c70 100644 --- a/src/examples/index.jsx +++ b/src/examples/index.jsx @@ -1,5 +1,4 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; import App from './app'; - -createRoot(document.getElementById('app')).render(); +createRoot(document.getElementById('root')).render(); diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..5a33944 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/webpack/webpack.dev.config.js b/webpack/webpack.dev.config.js deleted file mode 100644 index ba1b28a..0000000 --- a/webpack/webpack.dev.config.js +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable import/no-extraneous-dependencies */ -const path = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const ESLintWebpackPlugin = require('eslint-webpack-plugin'); - -module.exports = { - entry: './src/examples/index.jsx', - output: { - path: path.resolve(__dirname, '..', 'dist'), - filename: 'bundle.js', - publicPath: '/', - }, - module: { - rules: [ - { - test: /\.(js|jsx)$/, - exclude: /node_modules/, - use: { loader: 'babel-loader' }, - }, - { - test: /\.css$/, - use: ['style-loader', 'css-loader'], - }, - { - test: /\.(png|jpg|jpeg|gif|svg)$/i, - type: 'asset/resource', - }, - ], - }, - resolve: { - extensions: ['.js', '.jsx'], - }, - plugins: [ - new HtmlWebpackPlugin({ template: './src/index.html', title: 'React Big Schedule' }), - new ESLintWebpackPlugin({ emitError: false, emitWarning: false, failOnError: false, extensions: ['js', 'jsx'] }), - ], - devServer: { - static: { directory: path.join(__dirname, '..', 'public') }, - compress: true, - port: 8080, - historyApiFallback: true, - }, -};