2016-07-07 23:23:18 +02:00
|
|
|
var path = require("path");
|
|
|
|
var webpack = require("webpack");
|
|
|
|
|
2016-08-04 15:28:07 +02:00
|
|
|
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
2016-07-25 01:04:09 +02:00
|
|
|
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
2016-07-25 23:22:44 +02:00
|
|
|
var postcssReporter = require("postcss-reporter");
|
2016-07-25 01:04:09 +02:00
|
|
|
var autoprefixer = require("autoprefixer");
|
2016-07-25 23:22:44 +02:00
|
|
|
var browsers = ["ie >= 9", "> 1%", "last 3 versions", "not op_mini all"];
|
2016-07-25 01:04:09 +02:00
|
|
|
|
2016-07-07 23:23:18 +02:00
|
|
|
module.exports = {
|
|
|
|
entry: {
|
2016-07-30 22:54:19 +02:00
|
|
|
"index": [
|
|
|
|
"babel-polyfill",
|
|
|
|
"bootstrap-loader",
|
2016-08-04 15:28:07 +02:00
|
|
|
"font-awesome-webpack",
|
2016-08-10 21:36:11 +02:00
|
|
|
// Add global style hacks
|
|
|
|
"./app/common/styles/index.js",
|
|
|
|
// Add utils in entry for prototypes modification
|
|
|
|
"./app/common/utils/index.js",
|
|
|
|
// Main entry point
|
2016-07-30 22:54:19 +02:00
|
|
|
"./index.js"],
|
2016-07-07 23:23:18 +02:00
|
|
|
"fix.ie9": "./fix.ie9.js"
|
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
2016-08-04 15:28:07 +02:00
|
|
|
path: path.join(__dirname, "public/"),
|
2016-07-07 23:23:18 +02:00
|
|
|
filename: "[name].js",
|
2016-07-26 21:01:27 +02:00
|
|
|
publicPath: "./"
|
2016-07-07 23:23:18 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
loaders: [
|
2016-07-25 01:04:09 +02:00
|
|
|
// Handle JS/JSX files
|
2016-07-07 23:23:18 +02:00
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
2016-07-28 01:22:48 +02:00
|
|
|
loader: "babel",
|
|
|
|
query: {
|
2016-07-28 23:14:52 +02:00
|
|
|
"cacheDirectory": ".cache/"
|
2016-07-28 01:22:48 +02:00
|
|
|
},
|
2016-07-07 23:23:18 +02:00
|
|
|
include: __dirname
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
2016-08-10 21:36:11 +02:00
|
|
|
// Handle CSS files
|
2016-07-25 01:04:09 +02:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2016-07-29 23:57:21 +02:00
|
|
|
loader: ExtractTextPlugin.extract(
|
|
|
|
"style-loader",
|
|
|
|
"css-loader?modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]" +
|
|
|
|
"!postcss-loader"
|
|
|
|
)
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
2016-08-10 21:36:11 +02:00
|
|
|
// Handle SASS files
|
2016-07-25 01:04:09 +02:00
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
2016-07-29 23:57:21 +02:00
|
|
|
loader: ExtractTextPlugin.extract(
|
|
|
|
"style-loader",
|
|
|
|
"css-loader?modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]" +
|
2016-07-30 19:50:04 +02:00
|
|
|
"!postcss-loader" +
|
2016-07-31 12:18:46 +02:00
|
|
|
"!sass-loader" +
|
|
|
|
"!sass-resources-loader"
|
2016-07-29 23:57:21 +02:00
|
|
|
)
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
2016-08-10 21:36:11 +02:00
|
|
|
// Fonts
|
2016-07-25 01:04:09 +02:00
|
|
|
{
|
|
|
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
2016-08-04 15:28:07 +02:00
|
|
|
loader: "file"
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
|
|
|
{
|
2016-08-04 15:28:07 +02:00
|
|
|
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
|
|
|
loader: "url-loader?limit=10000&minetype=application/font-woff"
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
2016-08-04 15:28:07 +02:00
|
|
|
loader: "url?limit=10000&mimetype=application/octet-stream"
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
2016-08-10 21:36:11 +02:00
|
|
|
// SVG
|
2016-07-25 01:04:09 +02:00
|
|
|
{
|
|
|
|
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
2016-08-04 15:28:07 +02:00
|
|
|
loader: "url?limit=10000&mimetype=image/svg+xml"
|
2016-07-07 23:23:18 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2016-08-10 21:36:11 +02:00
|
|
|
// Copy some useful files to the output path
|
2016-08-04 15:28:07 +02:00
|
|
|
new CopyWebpackPlugin([
|
|
|
|
{ from: "./index.html" },
|
2016-08-10 21:36:11 +02:00
|
|
|
{ from: "./favicon.ico" },
|
|
|
|
{ from: "./app/assets" },
|
|
|
|
{ from: "./app/vendor" }
|
2016-08-04 15:28:07 +02:00
|
|
|
]),
|
2016-08-10 21:36:11 +02:00
|
|
|
// Provide jQuery
|
2016-07-25 01:04:09 +02:00
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
$: "jquery",
|
|
|
|
jQuery: "jquery"
|
|
|
|
}),
|
2016-08-10 21:36:11 +02:00
|
|
|
// Extract CSS
|
2016-07-25 01:04:09 +02:00
|
|
|
new ExtractTextPlugin("style.css", { allChunks: true })
|
2016-07-07 23:23:18 +02:00
|
|
|
],
|
|
|
|
|
2016-08-10 21:36:11 +02:00
|
|
|
// PostCSS config
|
|
|
|
postcss: [
|
|
|
|
autoprefixer({ browsers: browsers }),
|
|
|
|
postcssReporter({ throwError: true, clearMessages: true })
|
|
|
|
],
|
2016-07-25 01:04:09 +02:00
|
|
|
|
2016-07-31 12:18:46 +02:00
|
|
|
sassResources: "./app/styles/variables.scss",
|
|
|
|
|
2016-07-07 23:23:18 +02:00
|
|
|
resolve: {
|
|
|
|
// Include empty string "" to resolve files by their explicit extension
|
|
|
|
// (e.g. require("./somefile.ext")).
|
|
|
|
// Include ".js", ".jsx" to resolve files by these implicit extensions
|
|
|
|
// (e.g. require("underscore")).
|
|
|
|
extensions: ["", ".js", ".jsx"],
|
|
|
|
|
|
|
|
// Hack for isotope
|
|
|
|
alias: {
|
|
|
|
"masonry": "masonry-layout",
|
|
|
|
"isotope": "isotope-layout"
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
2016-07-07 23:23:18 +02:00
|
|
|
}
|
|
|
|
};
|