diff --git a/package.json b/package.json index e04ec7616..c7369bb2f 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "build": "NODE_ENV=production webpack --progress --config webpack.js", "dev": "NODE_ENV=development webpack --progress --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:fix": "eslint --ext .js,.vue src --fix", "stylelint": "stylelint src", diff --git a/webpack.js b/webpack.js index d5db80b35..e5fad1012 100644 --- a/webpack.js +++ b/webpack.js @@ -5,6 +5,7 @@ const StyleLintPlugin = require('stylelint-webpack-plugin') const buildMode = process.env.NODE_ENV const isDev = buildMode === 'development' +const isDevServer = process.env.WEBPACK_DEV_SERVER; webpackConfig.entry = { ...webpackConfig.entry, @@ -15,12 +16,16 @@ webpackConfig.entry = { 'card-reference': path.join(__dirname, 'src', 'init-card-reference.js'), } -webpackConfig.stats = { - context: path.resolve(__dirname, 'src'), - assets: true, - entrypoints: true, - chunks: true, - modules: true, +if (isDevServer) { + webpackConfig.output.publicPath = 'http://127.0.0.1:3000/' +} else { + webpackConfig.stats = { + context: path.resolve(__dirname, 'src'), + assets: true, + entrypoints: true, + chunks: true, + modules: true, + } } webpackConfig.plugins.push(