美文网首页
webpack 配置参考(production)

webpack 配置参考(production)

作者: wlianfu | 来源:发表于2018-02-13 10:50 被阅读8次
    const path = require('path')
    const ManifistPlugin = require('webpack-manifest-plugin')
    const ExtractTextPlugin = require('extract-text-webpack-plugin')
    const HtmlWebpackPlugin = require('html-webpack-plugin')
    const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
    
    const modules = require('./config/base')
    
    const config = {
      entry: {
        app: path.join(__dirname, '/src/container/render')
      },
      output: {
        path: path.join(__dirname, '/build'),
        filename: '[name].[hash:5].js'
      },
      module: modules,
      resolve: {
        extensions: ['.js', '.jsx', '.json', '.css', '.scss', '.sass'],
        alias: {
          '@': path.join(__dirname, '/src/container')
        }
      },
      plugins: [
        new ManifistPlugin(),
        new ExtractTextPlugin('style.css'),
        new HtmlWebpackPlugin({
          template: path.join(__dirname, '/index.html')
        }),
        new UglifyJSPlugin({
          exclude: /node_modules/
        })
      ]
    }
    
    module.exports = config
    
    

    相关文章

      网友评论

          本文标题:webpack 配置参考(production)

          本文链接:https://www.haomeiwen.com/subject/qorjtftx.html