v-react-pivottable/node_modules/react-sortablejs/webpack.config.js

49 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2024-12-16 20:19:32 -06:00
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const pkg = require('./package.json');
const banner = pkg.name + ' v' + pkg.version + ' | (c) ' + new Date().getFullYear() + ' ' + pkg.author + ' | ' + pkg.license + ' | ' + pkg.homepage;
const env = process.env.BUILD_ENV;
module.exports = {
mode: 'production',
entry: path.resolve(__dirname, 'lib/index.js'),
output: {
path: path.join(__dirname, 'dist'),
filename: (env === 'dist') ? 'react-sortable.min.js' : 'react-sortable.js',
libraryTarget: 'umd',
library: 'ReactSortable'
},
optimization: {
minimizer: [
(env === 'dist') && (
new TerserPlugin()
)
].filter(Boolean)
},
plugins: [
new webpack.BannerPlugin(banner),
],
externals: {
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
},
'sortablejs': {
root: 'Sortable',
commonjs2: 'sortablejs',
commonjs: 'sortablejs',
amd: 'sortablejs'
}
}
};