'use strict';var ExtractTextPlugin = require("extract-text-webpack-plugin"); ?//css單獨打包var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");module.exports={ ? ?entry:'./app.js',//唯一入口文件 ? ?output: { ? ? ? ?path:__dirname+ "/dist",//打包后文件存放的位置, ? ? ? ?filename: "main.js",//打包后輸出文件的文件名 ? ? ? ?publicPath: 'http://localhost:9999/dist/' ?//啟動本地服務(wù)后的根目錄 ? ?}, ? ?module:{ ? ? ? ?loaders: [ ? ? ? ? ? ?{ test: /\.js$/, loader: "babel-loader", exclude: /^node_modules$/,query:{ ? ? ? ? ? ? ? ?presets: ['es2015', 'react', 'stage-2'], ? ? ? ? ? ?}}, ? ? ? ? ? ?{ test: /\.css$/, loader:'css-loader!autoprefixer-loader'}, ? ? ? ? ? ?{ test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, ? ? ? ? ? ?{ test: /\.(png|jpg|gif)$/, loader: 'url?limit=819200'} ? ? ? ?] ? ?}, ? ?devServer: { ? ? ? ?contentBase: './dist', ?//本地服務(wù)器所加載的頁面所在的目錄 ? ? ? ?port: 9999, ? ? ? ?// colors: true, ?//終端中輸出結(jié)果為彩色 ? ? ? ?historyApiFallback: true, ?//不跳轉(zhuǎn) ? ? ? ?inline: true ?//實時刷新 ? ?}, ? ?plugins: [ ? ? ? ?new ExtractTextPlugin('css[name].css'), ? ?]};
添加回答
舉報
0/150
提交
取消