@nextcloud/webpack-vue-config

A webpack vue config for nextcloud apps
534,248 9
Install
npm install @nextcloud/webpack-vue-config
Latest Version:7.1.0
Vue:2 · 3
License:AGPL-3.0-or-later
Last Updated:Oct 25, 2026
Links: GitHub  ·  npm
Maintainer: icewind1991

Webpack vue base config

REUSE status npm last version Dependabot status

Use this base config package to cleanup all your complicated setups and rely on automated dependencies updates.

How-to

// webpack.config.js

const webpackConfig = require('@nextcloud/webpack-vue-config')

module.exports = webpackConfig
// package.json

...
	"scripts": {
		"build": "webpack --node-env production --progress",
		"dev": "webpack --node-env development --progress",
		"watch": "webpack --node-env development --progress --watch",
		"serve": "webpack --node-env development serve --progress",
	}
...

Note on Vue 2 support

This package supports both Vue 2 and Vue 3. While Vue 3 is supported by default, Vue 2 requires an explicit legacy vue-loader installation:

npm i -D vue-loader@legacy

Hot module replacement

To enjoy hot module replacement, follow those instructions:

  • Install the HMREnabler server app. This will tweak the CSP header so do not use it in production !
  • Add the serve script to your package.json as listed above.
  • Add js/*hot-update.* to you .gitignore. This is necessary because we write every files on disk so the nextcloud server can serve them.
  • Add the following line in your Vue app entry file so Webpack knows where to fetch updates, see this example. You might not need it as it default to /apps/<your_app_name>/js/.
__webpack_public_path__ = generateFilePath(appName, '', 'js/')

You can then start you dev serve with npm serve or make serve-js if you added this step in your makefile.

  • Your Nextcloud server hostname will probably be different than localhost. In that case, you will need specify it with --allowed-hosts.
  • Your public path will probably not be /apps/{app-name}/js. In that case, you will need to specify it with --static-public-path.
npm run serve -- --allowed-hosts your-hostname.example [other-hostname.example ...] --static-public-path /your/custom/public/path

Extend with your own configs

Here is an example on how to add your own config to the base one

// webpack.config.js

const path = require('path')
const webpack = require('webpack')
const webpackConfig = require('@nextcloud/webpack-vue-config')

webpackConfig.entry['files-action'] = path.join(__dirname, 'src', 'files_action.js')
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))

module.exports = webpackConfig

Replace/edit existing rule

All the rules are available individually on the @nextcloud/webpack-vue-config/rules file. You can import them and use the one you want.

If you want to override a rule that is already provided by this package, you can use the following to replace it:

// webpack.config.js

const webpackConfig = require('@nextcloud/webpack-vue-config')
const webpackRules = require('@nextcloud/webpack-vue-config/rules')

const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')

// Edit JS rule
webpackRules.RULE_JS.test = /\.m?js$/
webpackRules.RULE_JS.exclude = BabelLoaderExcludeNodeModulesExcept([
	'@nextcloud/dialogs',
	'@nextcloud/event-bus',
	'camelcase',
	'fast-xml-parser',
	'hot-patcher',
	'semver',
	'vue-plyr',
	'webdav',
	'toastify-js',
])

// Replaces rules array
webpackConfig.module.rules = Object.values(webpackRules)

module.exports = webpackConfig

Related Packages

@nextcloud/eslint-config

Eslint shared config for nextcloud apps and libraries

1,036,641 9
@vue/create-eslint-config

Utility to setup ESLint in Vue.js projects.

27,225 52
eslint-config-ktsn-vue

ESLint config for Vue.js project

12,758 1
@all-star/vue

Bring `best-shot` and `nice-move` together

10,241 3
@detools/eslint-config-vue

Eslint Shared Config for Vue based on AirBnB Styleguide

8,977 1

Version History

Version Released Vue License
7.1.0 ^2.7.16 || ^3.5.13 AGPL-3.0-or-later
7.0.4 ^2.7.16 || ^3.5.13 AGPL-3.0-or-later
7.0.3 ^2.7.16 || ^3.5.13 AGPL-3.0-or-later
7.0.2 ^2.7.16 || ^3.5.13 AGPL-3.0-or-later
7.0.1 ^2.7.16 || ^3.5.13 AGPL-3.0-or-later
Pre-releases (8)
Version Released License
4.0.3-alpha.2 AGPL-3.0-or-later
4.0.3-alpha.1 AGPL-3.0-or-later
4.0.3-alpha.0 AGPL-3.0-or-later
4.0.0-beta.0 AGPL-3.0-or-later
3.0.0-beta.0 AGPL-3.0-or-later