feat: provide usable UMD builds for all packages (#2141)
This commit is contained in:
committed by
Shawn Erquhart
parent
1d935c704d
commit
82cc7941cc
@ -1,43 +1,21 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const pkg = require('./package.json');
|
||||
const { getConfig, rules } = require('../../scripts/webpack.js');
|
||||
const { getConfig } = require('../../scripts/webpack.js');
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
const baseConfig = getConfig();
|
||||
const versionPlugin = new webpack.DefinePlugin({
|
||||
NETLIFY_CMS_VERSION: null,
|
||||
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
...baseConfig,
|
||||
context: path.join(__dirname, 'src'),
|
||||
entry: ['./index.js'],
|
||||
module: {
|
||||
rules: [
|
||||
...Object.entries(rules)
|
||||
.filter(([key]) => key !== 'js')
|
||||
.map(([, rule]) => rule()),
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
configFile: path.join(__dirname, 'babel.config.js'),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
include: [/(ol|redux-notifications|react-datetime)/],
|
||||
use: ['to-string-loader', 'css-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
...baseConfig.plugins,
|
||||
new webpack.DefinePlugin({
|
||||
NETLIFY_CMS_VERSION: null,
|
||||
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||
}),
|
||||
],
|
||||
const configs = () => {
|
||||
return getConfig().map(config => {
|
||||
return {
|
||||
...config,
|
||||
plugins: [...config.plugins, versionPlugin],
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = configs();
|
||||
|
Reference in New Issue
Block a user