webpack.config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * @Author: Bachir Soussi Chiadmi <bach>
  3. * @Date: 11-04-2017
  4. * @Email: bachir@figureslibres.io
  5. * @Last modified by: bach
  6. * @Last modified time: 16-04-2017
  7. * @License: GPL-V3
  8. */
  9. var webpack = require('webpack');
  10. var ExtractTextPlugin = require('extract-text-webpack-plugin');
  11. module.exports = {
  12. entry: ["./assets/main.js", "./assets/main.scss"],
  13. output: {
  14. path: __dirname + "/assets/dist/",
  15. filename: "main.js"
  16. },
  17. devtool: 'source-map',
  18. module: {
  19. rules: [
  20. /* your other rules for JavaScript transpiling go in here */
  21. {
  22. // regular css files
  23. test: /\.css$/,
  24. use: ExtractTextPlugin.extract({ loader: 'css-loader?importLoaders=1', }),
  25. },
  26. {
  27. // sass / scss loader for webpack
  28. test: /\.(sass|scss)$/,
  29. use: ExtractTextPlugin.extract(['css-loader', 'sass-loader'])
  30. },
  31. {
  32. // fonts
  33. test: /\.(eot|svg|ttf|woff|woff2)$/,
  34. use: "file-loader?name=fonts/[name].[ext]"
  35. },
  36. ]
  37. },
  38. plugins: [
  39. new ExtractTextPlugin({
  40. // define where to save the file
  41. filename: '[name].css', allChunks: true,
  42. }),
  43. new webpack.optimize.UglifyJsPlugin({
  44. compress: {
  45. warnings: false
  46. }
  47. })
  48. ],
  49. watch: true
  50. };