zoukankan      html  css  js  c++  java
  • webpack.dev.conf.js

    var utils = require('./utils')
    var webpack = require('webpack')
    var config = require('../config')

    // 一个可以合并数组和对象的插件
    var merge = require('webpack-merge')
    var baseWebpackConfig = require('./webpack.base.conf')

    // 一个用于生成HTML文件并自动注入依赖文件(link/script)的webpack插件
    var HtmlWebpackPlugin = require('html-webpack-plugin')

    // 用于更友好地输出webpack的警告、错误等信息
    var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')

    // add hot-reload related code to entry chunks
    Object.keys(baseWebpackConfig.entry).forEach(function (name) {
    baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
    })

    // 合并基础的webpack配置
    module.exports = merge(baseWebpackConfig, {
    // 配置样式文件的处理规则,使用styleLoaders

    module: {
    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
    },

    // 配置Source Maps。在开发中使用cheap-module-eval-source-map更快
    devtool: '#cheap-module-eval-source-map',

    // 配置webpack插件
    plugins: [
    new webpack.DefinePlugin({
    'process.env': config.dev.env
    }),
    // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
    new webpack.HotModuleReplacementPlugin(),

    // 后页面中的报错不会阻塞,但是会在编译结束后报错
    new webpack.NoEmitOnErrorsPlugin(),
    // https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
    filename: 'index.html',
    template: 'index.html',
    inject: true
    }),
    new FriendlyErrorsPlugin()
    ]
    })

  • 相关阅读:
    iOS Hardware Guide
    安卓上为什么不能用system.io.file读取streammingAssets目录下的文件
    【转】【Unity+Lua】实测如何性能优化(Lua和C#交互篇)
    随手记:IDAPro蛮强大
    断线重连
    稀土掘金
    C#利用WebService接口下载文件
    C# sbyte[]转byte[]
    百度地图API示例 JS
    如何才能成为一个好的技术领导者?
  • 原文地址:https://www.cnblogs.com/moneyss/p/7098570.html
Copyright © 2011-2022 走看看