From 717fb854533c84db1d83a3ccf448c8b03796d141 Mon Sep 17 00:00:00 2001 From: Raff Viglianti Date: Tue, 19 Nov 2024 10:07:52 -0500 Subject: [PATCH] fixed build and cleaned up more --- package.json | 8 ---- vite.config.js | 18 ++++---- webpack.config.js | 103 ---------------------------------------------- 3 files changed, 10 insertions(+), 119 deletions(-) delete mode 100644 webpack.config.js diff --git a/package.json b/package.json index 5feccdb..03d4be0 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,6 @@ }, "homepage": "https://github.com/TEIC/romajs#readme", "devDependencies": { - "@babel/preset-env": "^7.25.8", - "@babel/preset-react": "^7.25.7", "@material/button": "0.43.0", "@material/card": "0.43.0", "@material/checkbox": "0.43.0", @@ -56,7 +54,6 @@ "axios": "^1.2.2", "babel-core": "^6.26.3", "babel-eslint": "^7.2.3", - "babel-loader": "^7.1.5", "babel-polyfill": "^6.26.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", @@ -64,16 +61,11 @@ "brace": "^0.11.1", "connected-react-router": "^6.5.2", "cross-env": "^5.2.0", - "css-loader": "^3.2.0", "dotenv": "^16.0.3", - "es6-promise": "^4.2.5", "eslint": "^4.19.1", - "eslint-loader": "^1.9.0", "eslint-plugin-react": "^7.11.1", "expect": "^1.20.2", "express": "^4.16.3", - "extract-text-webpack-plugin": "^3.0.0", - "file-loader": "^1.1.11", "file-saver": "^1.3.8", "form-data": "^2.3.2", "linkedom": "0.14.21", diff --git a/vite.config.js b/vite.config.js index e5ede86..8bf3886 100644 --- a/vite.config.js +++ b/vite.config.js @@ -17,21 +17,23 @@ export default defineConfig({ modules: { generateScopedName: '[local]', }, - /* preprocessorOptions: { - scss: { - additionalData: `@import "src/scss/romajs.scss";`, - }, - }, */ }, build: { + minify: true, outDir: 'dist', rollupOptions: { input: { - main: path.resolve(__dirname, 'src/index.html'), + main: path.resolve(__dirname, './index.html'), }, output: { - entryFileNames: 'romajs_[hash].js', - }, + entryFileNames: 'romajs.js', + assetFileNames: (assetInfo) => { + if (assetInfo.name === "main.css") { + return "romajs.css" + } + return assetInfo.name + } + } }, }, server: { diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 734ac96..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,103 +0,0 @@ -let path = require('path'), - glob = require('glob'), - webpack = require('webpack'), - HtmlWebpackPlugin = require('html-webpack-plugin') - -let DIST_DIR = path.join(__dirname, 'dist'), - CLIENT_DIR = path.join(__dirname, 'src') - -const isDevelopment = process.env.NODE_ENV !== 'production' - -const publicPath = isDevelopment ? '/' : '' - -module.exports = { - context: CLIENT_DIR, - - entry: ['./index'], - - output: { - path: DIST_DIR, - publicPath, - filename: 'romajs_[hash].js' - }, - - plugins: [ - new webpack.EnvironmentPlugin(), - new HtmlWebpackPlugin({ - template: 'index.html', - inject: 'body', - filename: 'index.html', - favicon: '../assets/favicon.ico', - }), - ], - - module: { - - rules: [ - { - test: /\.jsx?$/, - exclude: /node_modules/, - use: ['babel-loader', 'eslint-loader'] - }, - { - test: /\.css$/, - exclude: /node_modules/, - use: [ - { - loader: 'style-loader', - }, - { - loader: 'css-loader', - options: { - modules: { - localIdentName: '[local]' - } - } - } - ] - }, - { - test: /\.scss$/, - use: [ - { - loader: 'style-loader' - }, - { - loader: 'css-loader', - options: { - importLoaders: 2, - modules: { - localIdentName: '[local]' - } - } - }, - { - loader: 'sass-loader', - options: { - outputStyle: 'expanded', - sourceMap: true, - sourceMapContents: true, - includePaths: glob.sync('node_modules').map((d) => path.join(__dirname, d)), - } - } - ] - }, - { - test: /\.(png|jpg|ttf|eot)$/, - exclude: /node_modules/, - use: [ - { - loader: 'url-loader', - options: {limit: 10000} - } - ] - } - ] - }, - - resolve: { - modules: ['node_modules', 'vendor'], - extensions: ['.js', '.json', '.css'] - } - -}