2016-10-21 21:18:45 -02:00
|
|
|
/* global module, __dirname, require */
|
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const merge = require('webpack-merge');
|
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
2017-10-30 13:59:11 -06:00
|
|
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
2016-10-21 21:18:45 -02:00
|
|
|
|
|
|
|
module.exports = merge.smart(require('./webpack.base.js'), {
|
|
|
|
entry: {
|
2016-10-26 19:51:35 +02:00
|
|
|
cms: './index',
|
2016-10-21 21:18:45 -02:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
|
|
|
filename: '[name].js',
|
2016-11-23 13:37:51 -08:00
|
|
|
library: 'netlify-cms',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
umdNamedDefine: true,
|
2016-10-21 21:18:45 -02:00
|
|
|
},
|
|
|
|
context: path.join(__dirname, 'src'),
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
2016-10-26 19:51:35 +02:00
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: JSON.stringify('production'),
|
|
|
|
},
|
2016-10-21 21:18:45 -02:00
|
|
|
}),
|
2017-04-15 01:35:08 +01:00
|
|
|
new webpack.DefinePlugin({
|
2017-06-12 17:59:58 -07:00
|
|
|
NETLIFY_CMS_VERSION: JSON.stringify(require("./package.json").version),
|
2017-04-15 01:35:08 +01:00
|
|
|
}),
|
2016-10-26 19:51:35 +02:00
|
|
|
|
2017-12-12 01:16:24 +00:00
|
|
|
// Combine/hoist module scopes when possible.
|
2017-11-22 18:16:56 -07:00
|
|
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
|
|
|
|
2016-10-26 19:51:35 +02:00
|
|
|
// Minify and optimize the JavaScript
|
2017-10-30 13:59:11 -06:00
|
|
|
new UglifyJsPlugin({
|
|
|
|
sourceMap: true,
|
2016-10-26 19:51:35 +02:00
|
|
|
}),
|
|
|
|
|
|
|
|
// Extract CSS
|
2017-06-12 17:59:58 -07:00
|
|
|
new ExtractTextPlugin({
|
|
|
|
filename: '[name].css',
|
|
|
|
allChunks: true
|
|
|
|
}),
|
2016-12-20 19:36:05 -02:00
|
|
|
|
|
|
|
// During beta phase, generate source maps for better errors
|
|
|
|
new webpack.SourceMapDevToolPlugin({
|
|
|
|
// asset matching
|
|
|
|
test: /\.js?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
|
|
|
|
// file and reference
|
|
|
|
filename: '[file].map',
|
|
|
|
}),
|
2016-10-21 21:18:45 -02:00
|
|
|
],
|
|
|
|
});
|