react-dropzone-uploader
Version:
React file dropzone and uploader: fully customizable, progress indicators, upload cancellation and restart, zero deps and excellent TypeScript support
46 lines (42 loc) • 1.05 kB
JavaScript
/* eslint import/no-extraneous-dependencies: 0 */
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const path = require('path')
if (process.env.NODE_ENV !== 'production') {
throw new Error('Production builds must have NODE_ENV=production.')
}
function createConfig(entry, output) {
return {
mode: 'production',
entry,
output,
optimization: {
minimizer: [new UglifyJSPlugin()],
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.css$/,
loaders: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
exclude: /node_modules/,
loader: 'url-loader?limit=10000',
},
],
},
}
}
module.exports = [
createConfig('./src/Dropzone.js', {
path: path.resolve('dist'),
libraryTarget: 'umd',
filename: 'react-dropzone-uploader.umd.js',
library: 'ReactDropzoneUploader',
}),
]