Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

58 righe
1.4 KiB

const path = require('path');
const webpack = require('webpack');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const moment = require('moment');
const now = moment().format('DD-MM-YYYY H:m:s');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const PACKAGE = require('./package.json'),
    version = PACKAGE.version,
    description = PACKAGE.description,
    homepage = PACKAGE.homepage;
const htmlPlugin = new HtmlWebPackPlugin({
    template: './index.html',
    filename: './index.html'
});
const BannerPlugin = new webpack.BannerPlugin({
    banner: `[name] - ${description}, 
@date: ${now}, 
@version: ${version},
@link: ${homepage}`
});
module.exports = {
    entry: {
        simpleParallax: './src/simpleParallax.js',
        'simpleParallax.min': './src/simpleParallax.js',
        index: './test/index.js'
    },
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: '[name].js',
        library: 'simpleParallax',
        libraryTarget: 'umd',
        umdNamedDefine: true,
        libraryExport: 'default'
    },
    optimization: {
        minimize: true,
        minimizer: [
            new UglifyJsPlugin({
                include: /\.min\.js$/
            })
        ]
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: ['babel-loader']
            }
        ]
    },
    plugins: [htmlPlugin, BannerPlugin]
};