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
e4e5c9a651
commit
c30bf3c936
@@ -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",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const StyleLintPlugin = require('stylelint-webpack-plugin')
|
|||||||
|
|
||||||
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,
|
||||||
@@ -15,6 +16,9 @@ webpackConfig.entry = {
|
|||||||
reference: path.join(__dirname, 'src', 'init-reference.js'),
|
reference: path.join(__dirname, 'src', 'init-reference.js'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDevServer) {
|
||||||
|
webpackConfig.output.publicPath = 'http://127.0.0.1:3000/'
|
||||||
|
} else {
|
||||||
webpackConfig.stats = {
|
webpackConfig.stats = {
|
||||||
context: path.resolve(__dirname, 'src'),
|
context: path.resolve(__dirname, 'src'),
|
||||||
assets: true,
|
assets: true,
|
||||||
@@ -22,6 +26,7 @@ webpackConfig.stats = {
|
|||||||
chunks: true,
|
chunks: true,
|
||||||
modules: true,
|
modules: true,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
webpackConfig.plugins.push(
|
webpackConfig.plugins.push(
|
||||||
new ESLintPlugin({
|
new ESLintPlugin({
|
||||||
|
|||||||
Reference in New Issue
Block a user