Created
November 5, 2015 15:41
-
-
Save i-van/6b554b9493c498c487f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var path = require('path'); | |
| var webpack = require("webpack"); | |
| var CleanPlugin = require('clean-webpack-plugin'); | |
| var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
| module.exports = { | |
| debug: true, | |
| context: path.join(__dirname, "sources"), | |
| entry: { | |
| "project": path.join(__dirname, "sources", "bootstrap.js"), | |
| "vendor": [ | |
| 'jquery', | |
| 'underscore', | |
| 'backbone', | |
| 'backbone.babysitter', | |
| 'backbone.wreqr', | |
| 'marionette', | |
| 'images-loaded', | |
| 'masonry' | |
| ] | |
| }, | |
| output: { | |
| path: path.join(__dirname, "distribution"), | |
| filename: "[name]-[hash].js", | |
| chunkFilename: "[id].bundle.[ext]" | |
| }, | |
| resolver: { | |
| root: path.join(__dirname, "sources"), | |
| modulesDirectories: ["web_modules", "node_modules", "loaders"], | |
| aliases: { | |
| 'owlcarousel': path.join(__dirname, 'web_modules', 'owlcarousel', 'owl-carousel', 'owl.carousel.js') | |
| } | |
| }, | |
| plugins: [ | |
| new CleanPlugin(['distribution']), | |
| new webpack.ResolverPlugin( | |
| new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"]), | |
| ["normal", "loader"] | |
| ), | |
| new ExtractTextPlugin("[name]-[hash].css"), | |
| new HtmlWebpackPlugin({ | |
| title: 'Getsha[Marionette]', | |
| template: path.join(__dirname, "static", "index.html") | |
| }), | |
| new webpack.optimize.CommonsChunkPlugin({ name: "vendor.js", filename: "vendor.js" }), | |
| new webpack.ProvidePlugin({ | |
| jQuery: "jquery" | |
| }) | |
| ], | |
| module: { | |
| loaders: [ | |
| { | |
| test: /\.hbs$/, | |
| loader: "handlebars-loader", | |
| query: { | |
| helperDirs: [__dirname + "/sources/helpers"] | |
| } | |
| }, | |
| {test: /\.ejs$/, loader: "ejs"}, | |
| { | |
| test: /\.js$/, loader: "babel", | |
| query: {optional: ['runtime'], compact: false}, exclude: /(node_modules|bower_components)/ | |
| }, | |
| { test: /\.less$/, loader: ExtractTextPlugin.extract('style', 'css!less?sourceMap') }, | |
| { test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css') }, | |
| {test: /(\.woff(\d+)?|\.ttf|\.eot|\.svg)(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=fonts/[name].[ext]"}, | |
| {test: /\.png|\.jpg|\.gif$/, loader: "file?name=img/[name].[ext]"}, | |
| {test: /backbone\.marionette\.js$/, loader: "imports?this=>window"}, | |
| {test: /EventEmitter\.js$/, loader: "imports?this=>window"} | |
| ] | |
| }, | |
| devServer: { | |
| contentBase: path.join(__dirname, "distribution"), | |
| noInfo: false, | |
| hot: true, | |
| inline: false | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment