webpack.config.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var webpack = require('webpack');
  2. var ExtractTextPlugin = require('extract-text-webpack-plugin');
  3. module.exports = {
  4. entry: ["./main.js", "./scss/main.scss"], //, "./scss/main.scss"
  5. output: {
  6. path: __dirname + "/static",
  7. filename: "main.js"
  8. },
  9. devtool: 'source-map',
  10. module: {
  11. rules: [
  12. /* your other rules for JavaScript transpiling go in here */
  13. {
  14. // regular css files
  15. test: /\.css$/,
  16. use: ExtractTextPlugin.extract({ loader: 'css-loader?importLoaders=1', }),
  17. },
  18. {
  19. // sass / scss loader for webpack
  20. test: /\.(sass|scss)$/,
  21. use: ExtractTextPlugin.extract(['css-loader', 'sass-loader'])
  22. },
  23. {
  24. // fonts
  25. test: /\.(eot|svg|ttf|woff|woff2)$/,
  26. use: "file-loader?name=fonts/[name].[ext]"
  27. },
  28. ]
  29. },
  30. plugins: [
  31. new ExtractTextPlugin({
  32. // define where to save the file
  33. filename: '[name].css', allChunks: true,
  34. }),
  35. new webpack.optimize.UglifyJsPlugin({
  36. compress: {
  37. warnings: false
  38. }
  39. })
  40. ]
  41. };