@dolaanpls/react-awesome-button
Version:
Performant, extendable, highly customisable, production ready React Component that renders an animated basic set of UI buttons
64 lines (60 loc) • 1.26 kB
JavaScript
const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');
const config = {
mode: 'production',
entry: {
index: ['./src/index.ts'],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
libraryTarget: 'umd',
library: 'react-awesome-button',
globalObject: 'this',
},
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
'prop-types': {
root: 'PropTypes',
commonjs: 'prop-types',
commonjs2: 'prop-types',
amd: 'prop-types',
},
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['es2015', 'react', 'stage-0'],
},
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
keep_fnames: true,
},
}),
],
},
};
module.exports = config;