webpacked the heck out of the build
This commit is contained in:
parent
0ab8ddc894
commit
757ac14d1a
16 changed files with 838 additions and 97 deletions
|
@ -1,14 +1,17 @@
|
|||
const path = require('path');
|
||||
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||
const webpack = require('webpack');
|
||||
const HtmlPlugin = require('html-webpack-plugin');
|
||||
const CopyPlugin = require('copy-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
vendor: ['babel-polyfill', 'raven-js'],
|
||||
upload: ['./frontend/src/upload.js'],
|
||||
download: ['./frontend/src/download.js']
|
||||
},
|
||||
output: {
|
||||
filename: '[name].[chunkhash].js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'resources/[name].[chunkhash].js',
|
||||
path: path.resolve(__dirname, 'dist/public'),
|
||||
publicPath: '/'
|
||||
},
|
||||
module: {
|
||||
|
@ -24,8 +27,98 @@ module.exports = {
|
|||
babelrc: false,
|
||||
presets: [['es2015', { modules: false }], 'stage-2']
|
||||
}
|
||||
},
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [new ManifestPlugin()]
|
||||
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'
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue