fox-send/webpack.config.js

125 lines
2.9 KiB
JavaScript
Raw Normal View History

2017-08-07 02:32:07 +00:00
const path = require('path');
2017-08-16 04:47:34 +00:00
const webpack = require('webpack');
const HtmlPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
2017-08-07 02:32:07 +00:00
module.exports = {
entry: {
2017-08-16 04:47:34 +00:00
vendor: ['babel-polyfill', 'raven-js'],
2017-08-07 02:32:07 +00:00
upload: ['./frontend/src/upload.js'],
download: ['./frontend/src/download.js']
},
output: {
2017-08-16 04:47:34 +00:00
filename: 'resources/[name].[chunkhash].js',
path: path.resolve(__dirname, 'dist/public'),
publicPath: '/'
2017-08-07 02:32:07 +00:00
},
module: {
2017-08-14 19:04:03 +00:00
rules: [
2017-08-07 02:32:07 +00:00
{
test: /\.js$/,
2017-08-14 19:04:03 +00:00
loader: 'babel-loader',
2017-08-09 19:56:32 +00:00
include: [
path.resolve(__dirname, 'frontend'),
path.resolve(__dirname, 'node_modules/testpilot-ga/src')
],
2017-08-14 19:04:03 +00:00
options: {
2017-08-09 19:56:32 +00:00
babelrc: false,
2017-08-10 17:02:13 +00:00
presets: [['es2015', { modules: false }], 'stage-2']
2017-08-09 19:56:32 +00:00
}
2017-08-16 04:47:34 +00:00
},
{
test: /\.(svg|png|jpg)$/,
loader: 'file-loader',
options: {
name: 'resources/[name].[hash].[ext]'
}
},
{
test: /\.css$/,
use: [
{
loader: 'file-loader',
options: {
name: 'resources/[name].[hash].[ext]'
}
},
'extract-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } },
'postcss-loader'
]
},
{
test: /\.hbs$/,
use: [
{
loader: 'html-loader',
options: {
interpolate: 'require',
minimize: false
}
}
]
2017-08-07 02:32:07 +00:00
}
]
2017-08-15 18:55:52 +00:00
},
2017-08-16 04:47:34 +00:00
plugins: [
new CopyPlugin([
{
context: 'public',
from: 'locales/**/*.ftl'
},
{
context: 'public',
from: '*.*'
},
{
from: 'views/**',
to: '../'
},
{
context: 'node_modules/l20n/dist/web',
from: 'l20n.min.js'
}
]),
new HtmlPlugin({
filename: '../views/index.handlebars',
template: 'webpack/upload.hbs',
chunks: ['upload']
}),
new HtmlPlugin({
filename: '../views/download.handlebars',
template: 'webpack/download.hbs',
chunks: ['download']
}),
new HtmlPlugin({
filename: '../views/legal.handlebars',
template: 'webpack/legal.hbs',
inject: false
}),
new HtmlPlugin({
filename: '../views/notfound.handlebars',
template: 'webpack/notfound.hbs',
inject: false
}),
new HtmlPlugin({
filename: '../views/layouts/main.handlebars',
template: 'webpack/layout.hbs',
inject: 'head',
excludeChunks: ['upload', 'download']
}),
new HtmlPlugin({
filename: '../views/unsupported.handlebars',
template: 'webpack/unsupported.hbs',
inject: false
}),
new webpack.HashedModuleIdsPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'runtime'
})
]
2017-08-07 02:32:07 +00:00
};