webpack.dev.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 HtmlWebpackPlugin({
  37. filename: '../download.html',
  38. template: './download.ejs',
  39. inject: false
  40. }),
  41. new webpack.ProvidePlugin({
  42. $: "jquery",
  43. jQuery: "jquery",
  44. "window.jQuery": "jquery"
  45. })
  46. ]);
  47. module.exports = config;