Skip to content

Conversation

@R0Wi
Copy link
Contributor

@R0Wi R0Wi commented Dec 22, 2025

  • Updated package.json to replace rspack commands with rsbuild equivalents.
  • Removed rspack.config.js and added rsbuild.config.js with new configuration.
  • Adjusted linting scripts to ensure proper file matching.
  • Updated dependencies to align with rsbuild requirements.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the build configuration from rspack to rsbuild, modernizing the build tooling while maintaining the same entry points and overall structure. The migration simplifies the configuration by leveraging rsbuild's higher-level abstractions and plugin system.

  • Replaced rspack CLI commands with rsbuild equivalents in npm scripts
  • Converted rspack.config.js to rsbuild.config.js using rsbuild plugins
  • Updated dependencies to use @rsbuild packages instead of @rspack
  • Fixed escaped asterisk in stylelint glob pattern

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.

File Description
rspack.config.js Removed the old rspack configuration file (169 lines)
rsbuild.config.js Added new rsbuild configuration with plugins for Vue, Sass, and Node polyfills
package.json Updated build/dev/watch scripts to use rsbuild commands, replaced rspack dependencies with rsbuild equivalents, changed browserslist config, and fixed lint script glob pattern

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

},
"browserslist": [
"extends @nextcloud/browserslist-config"
"last 2 major versions"
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The browserslist configuration has changed from 'extends @nextcloud/browserslist-config' to 'last 2 major versions'. This is a significant change that could affect browser compatibility. The new configuration is much more permissive and might not align with Nextcloud's supported browser policy. This change should be intentional and documented, or should continue to use the @nextcloud/browserslist-config to maintain consistency with the Nextcloud ecosystem.

Suggested change
"last 2 major versions"
"extends @nextcloud/browserslist-config"

Copilot uses AI. Check for mistakes.
Comment on lines 12 to 71
module.exports = defineConfig({
plugins: [
pluginVue(),
pluginSass(),
pluginNodePolyfill(),
],
source: {
entry: {
main: path.resolve(__dirname, 'src', 'main.js'),
globalSettings: path.resolve(__dirname, 'src', 'globalSettings.js'),
},
},
output: {
distPath: {
root: path.resolve(__dirname, 'js'),
js: '.',
},
filename: {
js: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
},
chunkFilename: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
assetModuleFilename: '[name][ext]',
publicPath: '/apps/workflow_ocr/js/',
injectStyles: true,
clean: true,
legalComments: 'none',
devtoolNamespace: process.env.npm_package_name,
devtoolModuleFilenameTemplate(info) {
const rootDir = process.cwd()
const rel = path.relative(rootDir, info.absoluteResourcePath)
return `webpack:///${process.env.npm_package_name}/${rel}`
},
},
define: {
IS_DESKTOP: false,
__IS_DESKTOP__: false,
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
__webpack_public_path__: '/apps/workflow_ocr/js/',
appName: JSON.stringify(process.env.npm_package_name),
appVersion: JSON.stringify(process.env.npm_package_version),
},
resolve: {
extensions: ['.js', '.vue', '.json'],
},
tools: {
rspack: {
cache: true,
resolve: {
symlinks: false,
fallback: {
fs: false,
},
},
optimization: {
splitChunks: false,
},
},
htmlPlugin: false,
},
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old rspack configuration had a sophisticated mode detection system that checked env.development, env.production, and process.env.NODE_ENV with a default of 'production'. It also had separate devtool settings and minimizer configuration based on the isDev flag. The new rsbuild configuration doesn't explicitly handle development vs production mode, which means the 'dev' script (line 17) that passes '--env development' may not work as expected since rsbuild.config.js doesn't use or process environment flags.

Suggested change
module.exports = defineConfig({
plugins: [
pluginVue(),
pluginSass(),
pluginNodePolyfill(),
],
source: {
entry: {
main: path.resolve(__dirname, 'src', 'main.js'),
globalSettings: path.resolve(__dirname, 'src', 'globalSettings.js'),
},
},
output: {
distPath: {
root: path.resolve(__dirname, 'js'),
js: '.',
},
filename: {
js: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
},
chunkFilename: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
assetModuleFilename: '[name][ext]',
publicPath: '/apps/workflow_ocr/js/',
injectStyles: true,
clean: true,
legalComments: 'none',
devtoolNamespace: process.env.npm_package_name,
devtoolModuleFilenameTemplate(info) {
const rootDir = process.cwd()
const rel = path.relative(rootDir, info.absoluteResourcePath)
return `webpack:///${process.env.npm_package_name}/${rel}`
},
},
define: {
IS_DESKTOP: false,
__IS_DESKTOP__: false,
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
__webpack_public_path__: '/apps/workflow_ocr/js/',
appName: JSON.stringify(process.env.npm_package_name),
appVersion: JSON.stringify(process.env.npm_package_version),
},
resolve: {
extensions: ['.js', '.vue', '.json'],
},
tools: {
rspack: {
cache: true,
resolve: {
symlinks: false,
fallback: {
fs: false,
},
},
optimization: {
splitChunks: false,
},
},
htmlPlugin: false,
},
module.exports = defineConfig((context = {}) => {
const env = context.env || {}
const isDev =
Boolean(env.development) ||
(!env.production && process.env.NODE_ENV === 'development')
return {
plugins: [
pluginVue(),
pluginSass(),
pluginNodePolyfill(),
],
source: {
entry: {
main: path.resolve(__dirname, 'src', 'main.js'),
globalSettings: path.resolve(__dirname, 'src', 'globalSettings.js'),
},
},
output: {
distPath: {
root: path.resolve(__dirname, 'js'),
js: '.',
},
filename: {
js: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
},
chunkFilename: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
assetModuleFilename: '[name][ext]',
publicPath: '/apps/workflow_ocr/js/',
injectStyles: true,
clean: true,
legalComments: 'none',
devtoolNamespace: process.env.npm_package_name,
devtoolModuleFilenameTemplate(info) {
const rootDir = process.cwd()
const rel = path.relative(rootDir, info.absoluteResourcePath)
return `webpack:///${process.env.npm_package_name}/${rel}`
},
},
define: {
IS_DESKTOP: false,
__IS_DESKTOP__: false,
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
__webpack_public_path__: '/apps/workflow_ocr/js/',
appName: JSON.stringify(process.env.npm_package_name),
appVersion: JSON.stringify(process.env.npm_package_version),
},
resolve: {
extensions: ['.js', '.vue', '.json'],
},
tools: {
rspack: {
cache: true,
devtool: isDev ? 'eval-source-map' : false,
resolve: {
symlinks: false,
fallback: {
fs: false,
},
},
optimization: {
splitChunks: false,
minimize: !isDev,
},
},
htmlPlugin: false,
},
}

Copilot uses AI. Check for mistakes.
js: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
},
chunkFilename: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
assetModuleFilename: '[name][ext]',
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assetModuleFilename is missing the version hash that was present in the old configuration. The old config had '[name][ext]?v=[contenthash]' while the new config only has '[name][ext]'. This means asset files won't have cache-busting query strings, which could lead to browser caching issues when assets are updated.

Suggested change
assetModuleFilename: '[name][ext]',
assetModuleFilename: '[name][ext]?v=[contenthash]',

Copilot uses AI. Check for mistakes.
},
chunkFilename: `${process.env.npm_package_name}-[name].js?v=[contenthash]`,
assetModuleFilename: '[name][ext]',
publicPath: '/apps/workflow_ocr/js/',
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The publicPath is hardcoded to '/apps/workflow_ocr/js/' which tightly couples this configuration to the workflow_ocr app. The old configuration used 'auto' for publicPath, which would automatically determine the correct path. This hardcoded value will break if the app name changes or if the configuration is reused in a different context.

Suggested change
publicPath: '/apps/workflow_ocr/js/',
publicPath: 'auto',

Copilot uses AI. Check for mistakes.
__IS_DESKTOP__: false,
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
__webpack_public_path__: '/apps/workflow_ocr/js/',
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The webpack_public_path is hardcoded to '/apps/workflow_ocr/js/' which creates the same coupling issue as the publicPath. This should be dynamic or configurable rather than hardcoded to a specific app name.

Copilot uses AI. Check for mistakes.
},
},
optimization: {
splitChunks: false,
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old configuration had sophisticated chunk splitting with cacheGroups configuration for vendor chunks. The new configuration disables splitChunks entirely with 'splitChunks: false'. This could negatively impact performance by preventing code splitting and vendor chunk optimization, potentially resulting in larger initial bundle sizes and reduced caching efficiency.

Suggested change
splitChunks: false,
splitChunks: {
chunks: 'all',
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
priority: -10,
},
common: {
minChunks: 2,
name: 'common',
chunks: 'all',
priority: -20,
},
},
},

Copilot uses AI. Check for mistakes.
- Updated package.json to replace rspack commands with rsbuild equivalents.
- Removed rspack.config.js and added rsbuild.config.js with new configuration.
- Adjusted linting scripts to ensure proper file matching.
- Updated dependencies to align with rsbuild requirements.
@R0Wi R0Wi force-pushed the fix/update-npm-deps branch from 96814d7 to 3b8fa83 Compare December 22, 2025 21:53
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants