Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. const webpack = require('webpack');
  2. const ExtractTextPlugin = require('extract-text-webpack-plugin');
  3. const extractCSS = new ExtractTextPlugin('css/style.css');
  4. const CopyWebpackPlugin = require('copy-webpack-plugin');
  5.  
  6. const config = {
  7. context: __dirname + '/src',
  8. entry: {
  9. app: './app.js',
  10. vendor: [
  11. 'blazy',
  12. 'fancybox',
  13. 'owl.carousel'
  14. ],
  15. constructor: './js/constructor.js',
  16. },
  17. resolve: {
  18. modules: ['node_modules']
  19. },
  20. output: {
  21. path: __dirname + '/dist',
  22. filename: 'js/[name].js'
  23. },
  24. module: {
  25. rules: [{
  26. test: /\.js$/,
  27. include: __dirname + '/src',
  28. use: [{
  29. loader: 'babel-loader',
  30. options: {
  31. presets: [
  32. ['es2015', { modules: false }]
  33. ]
  34. }
  35. }]
  36. },
  37. {
  38. test: /\.(jpe?g|png|gif)$/i,
  39. loader: "file-loader?name=../images/[name].[ext]&outputPath=../dist/images/"
  40. },
  41. {
  42. test: /\.(eot|svg|ttf|woff|woff2)$/,
  43. loader: 'file-loader?name=../fonts/[name].[ext]&outputPath=../dist/fonts/'
  44. },
  45. {
  46. test: /style\.less$/,
  47. loader: ExtractTextPlugin.extract({
  48. fallbackLoader: 'style-loader',
  49. loader: "css-loader!less-loader",
  50. })
  51. }
  52. ]
  53. },
  54. plugins: [
  55. extractCSS,
  56. new webpack.ProvidePlugin({
  57. $: 'jquery',
  58. jQuery: 'jquery',
  59. "window.jQuery": "jquery/dist/jquery.min.js"
  60. }),
  61. new CopyWebpackPlugin([
  62. { from: './images', to: './images' },
  63. { from: '../../../node_modules/constructor/dist/constructor.js', to: './js/constructor.lib.min.js' }
  64. ]),
  65. new webpack.optimize.CommonsChunkPlugin({
  66. name: "vendor",
  67. minChunks: Infinity,
  68. })
  69. ],
  70. };
  71.  
  72. module.exports = config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement