2018-07-17 19:13:52 -04:00
|
|
|
const path = require('path');
|
2018-07-27 14:26:03 -04:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const pkg = require('./package.json');
|
2018-08-07 09:53:31 -06:00
|
|
|
const { getConfig, rules } = require('../../scripts/webpack.js');
|
2018-07-24 00:27:49 -04:00
|
|
|
|
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
|
|
|
2018-07-28 17:11:29 -04:00
|
|
|
const baseConfig = getConfig();
|
2018-07-17 19:13:52 -04:00
|
|
|
|
|
|
|
module.exports = {
|
2018-07-28 17:11:29 -04:00
|
|
|
...baseConfig,
|
2018-07-17 19:13:52 -04:00
|
|
|
context: path.join(__dirname, 'src'),
|
2018-07-28 17:11:29 -04:00
|
|
|
entry: ['./index.js'],
|
2018-07-17 19:13:52 -04:00
|
|
|
module: {
|
2018-07-23 12:30:15 -04:00
|
|
|
rules: [
|
2018-07-23 21:25:49 -04:00
|
|
|
...Object.entries(rules)
|
|
|
|
.filter(([ key ]) => key !== 'js')
|
2018-08-07 09:53:31 -06:00
|
|
|
.map(([ , rule ]) => rule()),
|
2018-07-23 21:25:49 -04:00
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
configFile: path.join(__dirname, 'babel.config.js'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-07-23 12:30:15 -04:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2018-07-25 05:37:38 -04:00
|
|
|
include: [/(redux-notifications|react-datetime)/],
|
2018-07-23 12:30:15 -04:00
|
|
|
use: ['to-string-loader', 'css-loader'],
|
|
|
|
},
|
|
|
|
],
|
2018-07-24 00:27:49 -04:00
|
|
|
},
|
|
|
|
plugins: [
|
2018-07-28 17:11:29 -04:00
|
|
|
...baseConfig.plugins,
|
2018-07-27 14:26:03 -04:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
NETLIFY_CMS_VERSION: null,
|
|
|
|
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
|
|
|
}),
|
2018-07-24 00:27:49 -04:00
|
|
|
],
|
2018-07-17 19:13:52 -04:00
|
|
|
};
|