亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請教下webpack+node express的使用

請教下webpack+node express的使用

楊__羊羊 2018-10-09 17:40:32
在寫組件的時候,會區分開發和生產環境,在webpack中使用插件html-webpack-plugin實現動態生成html文件,使用node 的express搭建一個服務器,webpack的代碼如下:生產環境下:config.plugins = [    // 提取css為單文件     new ExtractTextPlugin("../[name].[contenthash].css"),    new HtmlWebpackPlugin({         filename: '../index.html',        template: path.resolve(__dirname, '../src/index.html'),         inject: true     }) ];開發環境下:config.plugins = [    new webpack.optimize.OccurenceOrderPlugin(),    new webpack.HotModuleReplacementPlugin(),    new webpack.NoErrorsPlugin(),    new HtmlWebpackPlugin({            filename: 'src/index.html',            template: path.resolve(__dirname, '../src/index.html'),            inject: true        })];請教下: HtmlWebpackPlugin中的filename 為什么不是一樣的,最后訪問localhost:8080必須加上/src才能看到對應的頁面,是什么原因??
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 763 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號