2018-07-25 05:37:38 -04:00
|
|
|
const path = require('path');
|
2018-07-27 14:26:03 -04:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const pkg = require('./package.json');
|
2018-07-25 05:37:38 -04:00
|
|
|
const coreWebpackConfig = require('../netlify-cms-core/webpack.config.js');
|
2018-07-23 23:40:48 -04:00
|
|
|
|
2018-07-27 14:26:03 -04:00
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
|
|
|
|
|
|
const baseConfig = {
|
|
|
|
...coreWebpackConfig,
|
|
|
|
context: path.join(__dirname, 'src'),
|
|
|
|
entry: './index.js',
|
|
|
|
plugins: [
|
2018-07-27 17:13:01 -04:00
|
|
|
...coreWebpackConfig.plugins.filter(plugin => !(plugin instanceof webpack.DefinePlugin)),
|
2018-07-27 14:26:03 -04:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
NETLIFY_CMS_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
|
|
|
NETLIFY_CMS_CORE_VERSION: null,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2018-07-27 11:08:17 -04:00
|
|
|
module.exports = [
|
2018-07-27 14:26:03 -04:00
|
|
|
baseConfig,
|
2018-07-27 11:08:17 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Output the same script a second time, but named `cms.js`, and with a
|
|
|
|
* deprecation notice.
|
|
|
|
*/
|
|
|
|
{
|
2018-07-27 14:26:03 -04:00
|
|
|
...baseConfig,
|
2018-07-27 11:08:17 -04:00
|
|
|
entry: [
|
|
|
|
path.join(__dirname, 'scripts/deprecate-old-dist.js'),
|
2018-07-27 14:26:03 -04:00
|
|
|
baseConfig.entry,
|
2018-07-27 11:08:17 -04:00
|
|
|
],
|
|
|
|
output: {
|
2018-07-27 14:26:03 -04:00
|
|
|
...baseConfig.output,
|
2018-07-27 11:08:17 -04:00
|
|
|
filename: 'dist/cms.js',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|