webpack.config.js 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const CleanWebpackPlugin = require('clean-webpack-plugin');
  4. const ExtractTextPlugin = require("extract-text-webpack-plugin");
  5. module.exports = {
  6. entry: './src/index.js',
  7. output: {
  8. filename: '[name].bundle.js',
  9. path: path.resolve(__dirname, 'dist')
  10. },
  11. devtool: 'inline-source-map',
  12. plugins: [
  13. new ExtractTextPlugin("styles.css"),
  14. new webpack.ProvidePlugin({ // inject ES5 modules as global vars
  15. $: 'jquery',
  16. jQuery: 'jquery',
  17. 'window.jQuery': 'jquery',
  18. Tether: 'tether'
  19. })
  20. ],
  21. module: {
  22. rules: [
  23. {
  24. test: /\.css$/,
  25. use: ExtractTextPlugin.extract({
  26. fallback: 'style-loader',
  27. use: 'css-loader'
  28. })
  29. },
  30. {
  31. test: /\.(png|svg|jpg|gif)$/,
  32. use: [
  33. 'file-loader'
  34. ]
  35. },
  36. {
  37. test: /\.(woff|woff2|eot|ttf|otf)$/,
  38. use: [
  39. 'file-loader'
  40. ]
  41. }
  42. ]
  43. }
  44. };