fix: log accurate version by distribution (#1531)
This commit is contained in:
@ -1 +1 @@
|
||||
console.warn('The `cms.js` file is deprecated and will be removed in the next major release. Please use `netlify-cms.js` instead.');
|
||||
console.warn('You seem to be loading Netlify CMS by fetching `dist/cms.js` from a CDN. That file is deprecated and will be removed in the next major release. Please use `dist/netlify-cms.js` instead.')
|
||||
|
@ -1,26 +1,38 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const pkg = require('./package.json');
|
||||
const coreWebpackConfig = require('../netlify-cms-core/webpack.config.js');
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
const baseConfig = {
|
||||
...coreWebpackConfig,
|
||||
context: path.join(__dirname, 'src'),
|
||||
entry: './index.js',
|
||||
plugins: [
|
||||
...coreWebpackConfig.plugins.filter(plugin => !plugin instanceof webpack.DefinePlugin),
|
||||
new webpack.DefinePlugin({
|
||||
NETLIFY_CMS_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||
NETLIFY_CMS_CORE_VERSION: null,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
...coreWebpackConfig,
|
||||
context: path.join(__dirname, 'src'),
|
||||
entry: './index.js',
|
||||
},
|
||||
baseConfig,
|
||||
|
||||
/**
|
||||
* Output the same script a second time, but named `cms.js`, and with a
|
||||
* deprecation notice.
|
||||
*/
|
||||
{
|
||||
...coreWebpackConfig,
|
||||
context: path.join(__dirname, 'src'),
|
||||
...baseConfig,
|
||||
entry: [
|
||||
...coreWebpackConfig.entry,
|
||||
path.join(__dirname, 'scripts/deprecate-old-dist.js'),
|
||||
baseConfig.entry,
|
||||
],
|
||||
output: {
|
||||
...coreWebpackConfig.output,
|
||||
...baseConfig.output,
|
||||
filename: 'dist/cms.js',
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user