mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 09:31:53 +01:00 
			
		
		
		
	Revert the rspack change (#35482)
Partially revert https://github.com/go-gitea/gitea/pull/35460 until rspack supports RISC-V (https://github.com/web-infra-dev/rspack/issues/11656).
This commit is contained in:
		
							parent
							
								
									4fe1066a17
								
							
						
					
					
						commit
						e612b9744c
					
				
							
								
								
									
										30
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								Makefile
									
									
									
									
									
								
							| @ -135,10 +135,10 @@ LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/r | ||||
| GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./... | grep -v /vendor/)) | ||||
| MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) | ||||
| 
 | ||||
| RSPACK_SOURCES := $(shell find web_src/js web_src/css -type f) | ||||
| RSPACK_CONFIGS := rspack.config.ts tailwind.config.ts | ||||
| RSPACK_DEST := public/assets/js/index.js public/assets/css/index.css | ||||
| RSPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts | ||||
| WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f) | ||||
| WEBPACK_CONFIGS := webpack.config.ts tailwind.config.ts | ||||
| WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css | ||||
| WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts | ||||
| 
 | ||||
| BINDATA_DEST_WILDCARD := modules/migration/bindata.* modules/public/bindata.* modules/options/bindata.* modules/templates/bindata.* | ||||
| 
 | ||||
| @ -238,7 +238,7 @@ node-check: | ||||
| 
 | ||||
| .PHONY: clean-all | ||||
| clean-all: clean ## delete backend, frontend and integration files
 | ||||
| 	rm -rf $(RSPACK_DEST_ENTRIES) node_modules | ||||
| 	rm -rf $(WEBPACK_DEST_ENTRIES) node_modules | ||||
| 
 | ||||
| .PHONY: clean | ||||
| clean: ## delete backend and integration files
 | ||||
| @ -428,8 +428,8 @@ watch: ## watch everything and continuously rebuild | ||||
| 
 | ||||
| .PHONY: watch-frontend | ||||
| watch-frontend: node-check node_modules ## watch frontend files and continuously rebuild
 | ||||
| 	@rm -rf $(RSPACK_DEST_ENTRIES) | ||||
| 	NODE_ENV=development $(NODE_VARS) pnpm exec rspack --watch | ||||
| 	@rm -rf $(WEBPACK_DEST_ENTRIES) | ||||
| 	NODE_ENV=development $(NODE_VARS) pnpm exec webpack --watch --progress --disable-interpret | ||||
| 
 | ||||
| .PHONY: watch-backend | ||||
| watch-backend: go-check ## watch backend files and continuously rebuild
 | ||||
| @ -747,7 +747,7 @@ install: $(wildcard *.go) | ||||
| build: frontend backend ## build everything
 | ||||
| 
 | ||||
| .PHONY: frontend | ||||
| frontend: $(RSPACK_DEST) ## build frontend files
 | ||||
| frontend: $(WEBPACK_DEST) ## build frontend files
 | ||||
| 
 | ||||
| .PHONY: backend | ||||
| backend: go-check generate-backend $(EXECUTABLE) ## build backend files
 | ||||
| @ -878,15 +878,15 @@ update-py: node-check | node_modules ## update py dependencies | ||||
| 	uv sync | ||||
| 	@touch .venv | ||||
| 
 | ||||
| .PHONY: rspack | ||||
| rspack: $(RSPACK_DEST) ## build rspack files
 | ||||
| .PHONY: webpack | ||||
| webpack: $(WEBPACK_DEST) ## build webpack files
 | ||||
| 
 | ||||
| $(RSPACK_DEST): $(RSPACK_SOURCES) $(RSPACK_CONFIGS) pnpm-lock.yaml | ||||
| $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) pnpm-lock.yaml | ||||
| 	@$(MAKE) -s node-check node_modules | ||||
| 	@rm -rf $(RSPACK_DEST_ENTRIES) | ||||
| 	@echo "Running rspack..." | ||||
| 	@$(NODE_VARS) pnpm exec rspack | ||||
| 	@touch $(RSPACK_DEST) | ||||
| 	@rm -rf $(WEBPACK_DEST_ENTRIES) | ||||
| 	@echo "Running webpack..." | ||||
| 	@BROWSERSLIST_IGNORE_OLD_DATA=true $(NODE_VARS) pnpm exec webpack --disable-interpret | ||||
| 	@touch $(WEBPACK_DEST) | ||||
| 
 | ||||
| .PHONY: svg | ||||
| svg: node-check | node_modules ## build svg files
 | ||||
|  | ||||
| @ -16,11 +16,9 @@ | ||||
|     "@mcaptcha/vanilla-glue": "0.1.0-alpha-3", | ||||
|     "@primer/octicons": "19.18.0", | ||||
|     "@resvg/resvg-wasm": "2.6.2", | ||||
|     "@rspack/cli": "1.5.3", | ||||
|     "@rspack/core": "1.5.3", | ||||
|     "@silverwind/vue3-calendar-heatmap": "2.0.6", | ||||
|     "@techknowlogick/license-checker-webpack-plugin": "0.3.0", | ||||
|     "add-asset-webpack-plugin": "3.1.0", | ||||
|     "add-asset-webpack-plugin": "3.1.1", | ||||
|     "ansi_up": "6.0.6", | ||||
|     "asciinema-player": "3.10.0", | ||||
|     "chart.js": "4.5.0", | ||||
| @ -32,11 +30,14 @@ | ||||
|     "dayjs": "1.11.18", | ||||
|     "dropzone": "6.0.0-beta.2", | ||||
|     "easymde": "2.20.0", | ||||
|     "esbuild-loader": "4.3.0", | ||||
|     "htmx.org": "2.0.7", | ||||
|     "idiomorph": "0.7.3", | ||||
|     "jquery": "3.7.1", | ||||
|     "katex": "0.16.22", | ||||
|     "mermaid": "11.11.0", | ||||
|     "mini-css-extract-plugin": "2.9.4", | ||||
|     "minimatch": "10.0.3", | ||||
|     "monaco-editor": "0.53.0", | ||||
|     "monaco-editor-webpack-plugin": "7.1.0", | ||||
|     "online-3d-viewer": "0.16.0", | ||||
| @ -60,6 +61,8 @@ | ||||
|     "vue-bar-graph": "2.2.0", | ||||
|     "vue-chartjs": "5.3.2", | ||||
|     "vue-loader": "17.4.2", | ||||
|     "webpack": "5.101.3", | ||||
|     "webpack-cli": "6.0.1", | ||||
|     "wrap-ansi": "9.0.2" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|  | ||||
							
								
								
									
										1947
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1947
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,17 +1,12 @@ | ||||
| import wrapAnsi from 'wrap-ansi'; | ||||
| import AddAssetPlugin from 'add-asset-webpack-plugin'; | ||||
| import LicenseCheckerWebpackPlugin from '@techknowlogick/license-checker-webpack-plugin'; | ||||
| import MiniCssExtractPlugin from 'mini-css-extract-plugin'; | ||||
| import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin'; | ||||
| import {VueLoaderPlugin} from 'vue-loader'; | ||||
| import EsBuildLoader from 'esbuild-loader'; | ||||
| import {parse} from 'node:path'; | ||||
| import { | ||||
|   SourceMapDevToolPlugin, | ||||
|   DefinePlugin, | ||||
|   EnvironmentPlugin, | ||||
|   CssExtractRspackPlugin, | ||||
|   type Configuration, | ||||
|   type EntryObject, | ||||
| } from '@rspack/core'; | ||||
| import webpack, {type Configuration, type EntryObject} from 'webpack'; | ||||
| import {fileURLToPath} from 'node:url'; | ||||
| import {readFileSync, globSync} from 'node:fs'; | ||||
| import {env} from 'node:process'; | ||||
| @ -20,6 +15,8 @@ import tailwindConfig from './tailwind.config.ts'; | ||||
| import tailwindcssNesting from 'tailwindcss/nesting/index.js'; | ||||
| import postcssNesting from 'postcss-nesting'; | ||||
| 
 | ||||
| const {EsbuildPlugin} = EsBuildLoader; | ||||
| const {SourceMapDevToolPlugin, DefinePlugin, EnvironmentPlugin} = webpack; | ||||
| const formatLicenseText = (licenseText: string) => wrapAnsi(licenseText || '', 80).trim(); | ||||
| 
 | ||||
| const themes: EntryObject = {}; | ||||
| @ -33,7 +30,7 @@ const isProduction = env.NODE_ENV !== 'development'; | ||||
| // true - all enabled, the default in development
 | ||||
| // reduced - minimal sourcemaps, the default in production
 | ||||
| // false - all disabled
 | ||||
| let sourceMaps: string; | ||||
| let sourceMaps; | ||||
| if ('ENABLE_SOURCEMAP' in env) { | ||||
|   sourceMaps = ['true', 'false'].includes(env.ENABLE_SOURCEMAP) ? env.ENABLE_SOURCEMAP : 'reduced'; | ||||
| } else { | ||||
| @ -96,12 +93,20 @@ export default { | ||||
|     path: fileURLToPath(new URL('public/assets', import.meta.url)), | ||||
|     filename: () => 'js/[name].js', | ||||
|     chunkFilename: ({chunk}) => { | ||||
|       const language = (/monaco.*languages?_.+?_(.+?)_/.exec(chunk.id) || [])[1]; | ||||
|       const language = (/monaco.*languages?_.+?_(.+?)_/.exec(String(chunk.id)) || [])[1]; | ||||
|       return `js/${language ? `monaco-language-${language.toLowerCase()}` : `[name]`}.[contenthash:8].js`; | ||||
|     }, | ||||
|   }, | ||||
|   optimization: { | ||||
|     minimize: isProduction, | ||||
|     minimizer: [ | ||||
|       new EsbuildPlugin({ | ||||
|         target: 'es2020', | ||||
|         minify: true, | ||||
|         css: true, | ||||
|         legalComments: 'none', | ||||
|       }), | ||||
|     ], | ||||
|     splitChunks: { | ||||
|       chunks: 'async', | ||||
|       name: (_, chunks) => chunks.map((item) => item.name).join('-'), | ||||
| @ -113,34 +118,45 @@ export default { | ||||
|     rules: [ | ||||
|       { | ||||
|         test: /\.vue$/i, | ||||
|         exclude: /[\\/]node_modules[\\/]/, | ||||
|         exclude: /node_modules/, | ||||
|         loader: 'vue-loader', | ||||
|         options: { | ||||
|           compilerOptions: { | ||||
|             isCustomElement: (tag: string) => webComponents.has(tag), | ||||
|           }, | ||||
|           experimentalInlineMatchResource: true, | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         test: /\.(j|t)s$/i, | ||||
|         exclude: /[\\/]node_modules[\\/]/, | ||||
|         loader: 'builtin:swc-loader', | ||||
|         options: { | ||||
|           jsc: { | ||||
|             parser: { | ||||
|               syntax: 'typescript', | ||||
|         test: /\.js$/i, | ||||
|         exclude: /node_modules/, | ||||
|         use: [ | ||||
|           { | ||||
|             loader: 'esbuild-loader', | ||||
|             options: { | ||||
|               loader: 'js', | ||||
|               target: 'es2020', | ||||
|             }, | ||||
|             externalHelpers: false, | ||||
|             target: 'es2020', | ||||
|           }, | ||||
|         }, | ||||
|         ], | ||||
|       }, | ||||
|       { | ||||
|         test: /\.ts$/i, | ||||
|         exclude: /node_modules/, | ||||
|         use: [ | ||||
|           { | ||||
|             loader: 'esbuild-loader', | ||||
|             options: { | ||||
|               loader: 'ts', | ||||
|               target: 'es2020', | ||||
|             }, | ||||
|           }, | ||||
|         ], | ||||
|       }, | ||||
|       { | ||||
|         test: /\.css$/i, | ||||
|         use: [ | ||||
|           { | ||||
|             loader: CssExtractRspackPlugin.loader, | ||||
|             loader: MiniCssExtractPlugin.loader, | ||||
|           }, | ||||
|           { | ||||
|             loader: 'css-loader', | ||||
| @ -189,7 +205,7 @@ export default { | ||||
|       TEST: 'false', | ||||
|     }), | ||||
|     new VueLoaderPlugin(), | ||||
|     new CssExtractRspackPlugin({ | ||||
|     new MiniCssExtractPlugin({ | ||||
|       filename: 'css/[name].css', | ||||
|       chunkFilename: 'css/[name].[contenthash:8].css', | ||||
|     }), | ||||
| @ -241,7 +257,7 @@ export default { | ||||
|   }, | ||||
|   stats: { | ||||
|     assetsSort: 'name', | ||||
|     assetsSpace: Number.MAX_SAFE_INTEGER, | ||||
|     assetsSpace: Infinity, | ||||
|     cached: false, | ||||
|     cachedModules: false, | ||||
|     children: false, | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user