chore(webpack): Add npm run serve command
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
committed by
backportbot-nextcloud[bot]
parent
4921f3dd62
commit
2fd8cab627
@@ -60,6 +60,14 @@ To build you will need to have [Node.js](https://nodejs.org/en/) and [Composer](
|
|||||||
- Watch for changes `npm run watch`
|
- Watch for changes `npm run watch`
|
||||||
- Production build `npm run build`
|
- Production build `npm run build`
|
||||||
|
|
||||||
|
### Faster frontend developing with HMR
|
||||||
|
|
||||||
|
You can enable HMR (Hot module replacement) to avoid page reloads when working on the frontend:
|
||||||
|
|
||||||
|
1. ☑️ Install and enable [`hmr_enabler` app](https://github.com/nextcloud/hmr_enabler)
|
||||||
|
2. 🏁 Run `npm run serve`
|
||||||
|
3. 🌍 Open the normal Nextcloud server URL (not the URL given by above command)
|
||||||
|
|
||||||
### GitHub Codespaces / VS Code devcontainer
|
### GitHub Codespaces / VS Code devcontainer
|
||||||
|
|
||||||
- Open code spaces or the repository in VS Code to start the dev container
|
- Open code spaces or the repository in VS Code to start the dev container
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"build": "NODE_ENV=production webpack --progress --config webpack.js",
|
"build": "NODE_ENV=production webpack --progress --config webpack.js",
|
||||||
"dev": "NODE_ENV=development webpack --progress --config webpack.js",
|
"dev": "NODE_ENV=development webpack --progress --config webpack.js",
|
||||||
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.js",
|
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.js",
|
||||||
|
"serve": "webpack serve --node-env development --allowed-hosts all --config webpack.js",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"lint": "eslint --ext .js,.vue src",
|
||||||
"lint:fix": "eslint --ext .js,.vue src --fix",
|
"lint:fix": "eslint --ext .js,.vue src --fix",
|
||||||
"lint:cypress": "eslint --ext .js cypress",
|
"lint:cypress": "eslint --ext .js cypress",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const path = require('path')
|
|||||||
|
|
||||||
const buildMode = process.env.NODE_ENV
|
const buildMode = process.env.NODE_ENV
|
||||||
const isDev = buildMode === 'development'
|
const isDev = buildMode === 'development'
|
||||||
|
const isDevServer = process.env.WEBPACK_DEV_SERVER;
|
||||||
|
|
||||||
webpackConfig.entry = {
|
webpackConfig.entry = {
|
||||||
...webpackConfig.entry,
|
...webpackConfig.entry,
|
||||||
@@ -13,14 +14,17 @@ webpackConfig.entry = {
|
|||||||
reference: path.join(__dirname, 'src', 'init-reference.js'),
|
reference: path.join(__dirname, 'src', 'init-reference.js'),
|
||||||
}
|
}
|
||||||
|
|
||||||
webpackConfig.stats = {
|
if (isDevServer) {
|
||||||
|
webpackConfig.output.publicPath = 'http://127.0.0.1:3000/'
|
||||||
|
} else {
|
||||||
|
webpackConfig.stats = {
|
||||||
context: path.resolve(__dirname, 'src'),
|
context: path.resolve(__dirname, 'src'),
|
||||||
assets: true,
|
assets: true,
|
||||||
entrypoints: true,
|
entrypoints: true,
|
||||||
chunks: true,
|
chunks: true,
|
||||||
modules: true,
|
modules: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for https://github.com/nextcloud/webpack-vue-config/pull/432 causing problems with nextcloud-vue-collections
|
// Workaround for https://github.com/nextcloud/webpack-vue-config/pull/432 causing problems with nextcloud-vue-collections
|
||||||
webpackConfig.resolve.alias = {}
|
webpackConfig.resolve.alias = {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user