webpack.config.js

原创
2017/08/20 14:38
阅读数 34
const fs = require('fs');
const webpack = require('webpack');
const path = require('path');

const nodeModules = {};
fs.readdirSync('node_modules').filter(x => {
    return x.indexOf('.bin') === -1;
}).forEach(mod => {
    nodeModules[mod] = `commonjs ${mod}`;
});

module.exports = {
    entry: './index.js',
    target: 'node',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'index.bundle.js'
    },
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false
            }
        })
    ],
    externals: nodeModules
};
展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部