2018-07-27 14:26:03 -04:00
|
|
|
const webpack = require('webpack');
|
2022-09-28 20:04:00 -06:00
|
|
|
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
|
2021-05-31 16:46:41 +02:00
|
|
|
|
2018-07-27 14:26:03 -04:00
|
|
|
const pkg = require('./package.json');
|
2022-09-28 20:04:00 -06:00
|
|
|
const { getConfig, plugins } = require('../../scripts/webpack.js');
|
|
|
|
const baseWebpackConfig = getConfig({ baseOnly: true });
|
2018-07-24 00:27:49 -04:00
|
|
|
|
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
2022-09-28 20:04:00 -06:00
|
|
|
const devServerPort = parseInt(process.env.NETLIFY_CMS_DEV_SERVER_PORT || `${8080}`);
|
2018-07-24 00:27:49 -04:00
|
|
|
|
2022-09-28 20:04:00 -06:00
|
|
|
const baseConfig = {
|
|
|
|
...baseWebpackConfig,
|
|
|
|
plugins: [
|
|
|
|
...Object.entries(plugins)
|
|
|
|
.filter(([key]) => key !== 'friendlyErrors')
|
|
|
|
.map(([, plugin]) => plugin()),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
|
|
|
}),
|
|
|
|
new FriendlyErrorsWebpackPlugin({
|
|
|
|
compilationSuccessInfo: {
|
|
|
|
messages: [`Netlify CMS is now running at http://localhost:${devServerPort}`],
|
|
|
|
},
|
|
|
|
})
|
|
|
|
],
|
|
|
|
devServer: {
|
|
|
|
contentBase: '../../dev-test',
|
|
|
|
watchContentBase: true,
|
|
|
|
publicPath: '/dist',
|
|
|
|
quiet: true,
|
|
|
|
host: '0.0.0.0',
|
|
|
|
port: devServerPort,
|
|
|
|
},
|
|
|
|
};
|
2018-07-17 19:13:52 -04:00
|
|
|
|
2022-09-28 20:04:00 -06:00
|
|
|
module.exports = baseConfig;
|