UNPKG

event-listener-helper

Version:

This library allows you to get a list of event listeners attached to the target node, confirms the existence of event listener registered on the target node, deletes all event listeners registered on the target node, registers event listeners with listene

87 lines (78 loc) 2.06 kB
const packageJson = require('./package.json'); const version = packageJson.version; const path = require('path'); const TerserPlugin = require('terser-webpack-plugin'); const webpack = require('webpack'); module.exports = (env, argv) => { const conf = { mode: 'development', devServer: { open: true, openPage: ['index.html'], contentBase: path.join(__dirname, 'example'), watchContentBase: true, port: 3000, host: argv.mode === 'production' ? `localhost` : `localhost`, disableHostCheck: true, }, entry: { 'event-listener-helper': ['./src/index.js'], }, output: { path: path.join(__dirname, 'lib'), publicPath: '/', filename: argv.mode === 'production' ? `[name].js` : `[name].js`, library: 'EventListenerHelper', libraryExport: 'default', libraryTarget: 'umd', globalObject: 'this', umdNamedDefine: true, auxiliaryComment: { root: 'for Root', commonjs: 'for CommonJS environment', commonjs2: 'for CommonJS2 environment', amd: 'for AMD environment', } }, optimization: { minimizer: [new TerserPlugin({ //extractComments: true, //cache: true, //parallel: true, //sourceMap: true, terserOptions: { compress: { drop_console: true, }, }, extractComments: false, })], }, module: { rules: [ { test: /\.js$/, exclude: /(node_modules|bower_components)/, use: [ { loader: 'babel-loader', }, { loader: 'eslint-loader', }, ], }, ], }, resolve: { alias: {} }, plugins: [ new webpack.BannerPlugin(`[name](https://github.com/riversun/[name]) v${version} Copyright (c) 2020 riversun.org@gmail.com`), ], }; if (argv.mode !== 'production') { conf.devtool = 'inline-source-map'; } return conf; };