webpack.dev.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. var webpack = require('webpack');
  2. var config = require('./webpack.base.config');
  3. var HtmlWebpackPlugin = require('html-webpack-plugin');
  4. var ExtractTextPlugin = require("extract-text-webpack-plugin");
  5. config.devtool = '#source-map';
  6. config.output.publicPath = '/';
  7. config.output.filename = '[name].js';
  8. config.output.chunkFilename = '[name].chunk.js';
  9. config.vue = {
  10. loaders : {
  11. css: ExtractTextPlugin.extract(
  12. "style-loader",
  13. "css-loader?sourceMap",
  14. {
  15. publicPath: '/',
  16. }
  17. ),
  18. less: ExtractTextPlugin.extract(
  19. 'vue-style-loader',
  20. 'css-loader!less-loader'
  21. ),
  22. sass: ExtractTextPlugin.extract(
  23. 'vue-style-loader',
  24. 'css-loader!sass-loader'
  25. )
  26. }
  27. }
  28. config.plugins = (config.plugins || []).concat([
  29. new ExtractTextPlugin("[name].css",{ allChunks : true, resolve : ['modules'] }),
  30. new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
  31. new HtmlWebpackPlugin({
  32. filename: '../index.html',
  33. template: './index.ejs',
  34. inject: false
  35. }),
  36. new webpack.ProvidePlugin({
  37. $: "jquery",
  38. jQuery: "jquery",
  39. "window.jQuery": "jquery"
  40. })
  41. ]);
  42. module.exports = config;