ampache_react/webpack.config.base.js

101 lines
3.1 KiB
JavaScript
Raw Normal View History

2016-07-07 23:23:18 +02:00
var path = require("path");
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
2016-07-25 23:22:44 +02:00
var postcssReporter = require("postcss-reporter");
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-07 23:23:18 +02:00
module.exports = {
entry: {
2016-07-30 22:54:19 +02:00
"index": [
"babel-polyfill",
"bootstrap-loader",
"./app/styles/common/index.js",
"./app/utils/common/index.js",
"./index.js"],
2016-07-07 23:23:18 +02:00
"fix.ie9": "./fix.ie9.js"
},
output: {
2016-07-26 21:01:27 +02:00
path: path.join(__dirname, "app/dist/"),
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: [
// Handle JS/JSX files
2016-07-07 23:23:18 +02:00
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel",
query: {
"cacheDirectory": ".cache/"
},
2016-07-07 23:23:18 +02:00
include: __dirname
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
"style-loader",
"css-loader?modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]" +
"!postcss-loader"
)
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract(
"style-loader",
"css-loader?modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]" +
"!postcss-loader" +
2016-07-31 12:18:46 +02:00
"!sass-loader" +
"!sass-resources-loader"
)
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file?name=fonts/[name].[ext]"
},
{
test: /\.(woff|woff2)$/,
loader:"url?name=fonts/[name].[ext]&limit=5000"
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/octet-stream"
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?name=img/[name].[ext]&limit=10000&mimetype=image/svg+xml"
2016-07-07 23:23:18 +02:00
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}),
new ExtractTextPlugin("style.css", { allChunks: true })
2016-07-07 23:23:18 +02:00
],
postcss: [autoprefixer({ browsers: browsers }), postcssReporter({ throwError: true, clearMessages: true })],
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-07 23:23:18 +02:00
}
};