diff --git a/packages/netlify-cms/webpack.config.js b/packages/netlify-cms/webpack.config.js index 9d80dfc9..a208270b 100644 --- a/packages/netlify-cms/webpack.config.js +++ b/packages/netlify-cms/webpack.config.js @@ -1,3 +1,5 @@ +const path = require('path'); +require('dotenv').config({ path: path.join(__dirname, '..', '..', '.env') }); const webpack = require('webpack'); const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); @@ -8,6 +10,8 @@ const baseWebpackConfig = getConfig({ baseOnly: true }); const isProduction = process.env.NODE_ENV === 'production'; console.log(`${pkg.version}${isProduction ? '' : '-dev'}`); +const devServerPort = parseInt(process.env.NETLIFY_CMS_DEV_SERVER_PORT || `${8080}`); + const baseConfig = { ...baseWebpackConfig, plugins: [ @@ -19,7 +23,7 @@ const baseConfig = { }), new FriendlyErrorsWebpackPlugin({ compilationSuccessInfo: { - messages: ['Netlify CMS is now running at http://localhost:8080'], + messages: [`Netlify CMS is now running at http://localhost:${devServerPort}`], }, }), new CopyWebpackPlugin([{ from: './shims/cms.css', to: './' }]), @@ -30,7 +34,7 @@ const baseConfig = { publicPath: '/dist/', quiet: true, host: '0.0.0.0', - port: 8080, + port: devServerPort, }, };