Tuesday, 4 April 2017

how to include frontend javascript files to bundle webpack

I need to bundle my front-end javascript files to bundle.js. here is my webpack.config file,

var path = require('path');
var nodeExternals = require('webpack-node-externals');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = {
    target: 'node',
    entry:['babel-polyfill', './bin/run.js'],
    output: {
        path: './build',
        filename: '[name].min.js'
    },
    externals: nodeModules,
    plugins: [
        new HtmlWebpackPlugin(),
        new webpack.optimize.UglifyJsPlugin({
            compressor: {
                warnings: false,
                screw_ie8: true
            }
        })
    ],
    module: {
        loaders: [
            {
                loader: 'babel-loader',
                test: /\.js$/,
                include:/public/,
                exclude: /(node_modules|bower_components)/
            }
        ],
        noParse: [/ws/]
    }
};

how can I include my front-end javascript files to the bundle ?



via Ddr Dushy

No comments:

Post a Comment