fabricatorjs
Version:
Generate fake test data
53 lines (46 loc) • 1.1 kB
JavaScript
const path = require('path');
const webpack = require('webpack');
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
const env = process.env.WEBPACK_ENV;
const libraryName = 'fabricator';
const plugins = [];
let outputFile;
if (env === 'build') {
plugins.push(new UglifyJsPlugin({ minimize: true }));
outputFile = `${libraryName}.min.js`;
} else {
outputFile = `${libraryName}.js`;
}
const config = {
entry: `${__dirname}/src/index.js`,
devtool: 'source-map',
output: {
path: `${__dirname}/lib`,
filename: outputFile,
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true,
},
module: {
loaders: [
{
test: /(\.jsx|\.js)$/,
loader: 'babel',
exclude: /(node_modules|bower_components)/,
},
{
test: /(\.jsx|\.js)$/,
loader: 'eslint-loader',
include: [`${__dirname}/src/`,
`${__dirname}/test/`],
exclude: /node_modules/,
},
],
},
resolve: {
root: path.resolve('./src'),
extensions: ['', '.js'],
},
plugins,
};
module.exports = config;