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.
@R0Wi R0Wi force-pushed the fix/update-npm-deps branch from 96814d7 to 3b8fa83 Compare December 22, 2025 21:53
@R0Wi
Copy link
Contributor Author

R0Wi commented Jan 10, 2026

@copilot Sonarqube complains abount src/appGlobals.js:

Prefer globalThis over window.

Use "globalThis" instead of "window", "self", or "global" javascript:S7764

Fix this issue but ensure tests are still working.

Copy link
Contributor

Copilot AI commented Jan 10, 2026

@R0Wi I've opened a new pull request, #349, to work on those changes. Once the pull request is ready, I'll request review from you.

R0Wi and others added 2 commits January 10, 2026 10:43
- 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 3b8fa83 to ce05b08 Compare January 10, 2026 10:46
@sonarqubecloud
Copy link

@R0Wi R0Wi marked this pull request as ready for review January 10, 2026 11:03
@R0Wi R0Wi merged commit dbc79b6 into master Jan 10, 2026
17 checks passed
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