combine.fm/webpack.config.js

59 lines
1.5 KiB
JavaScript
Raw Normal View History

const path = require('path');
const webpack = require('webpack');
2017-05-07 00:02:20 +01:00
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
module.exports = {
entry: './public/src/entry-client.js',
output: {
path: path.resolve(__dirname, './public/dist'),
publicPath: '/dist/',
2017-05-07 00:02:20 +01:00
filename: 'js/[name].[hash:10].js',
},
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, 'public/src'),
],
extensions: ['.js', '.json', '.vue', '.css'],
},
module: {
loaders: [
{
test: /\.vue$/,
2017-05-06 21:15:47 +01:00
loader: 'vue-loader',
2017-05-07 00:02:20 +01:00
options: {
extractCSS: true
},
},
{
test: /\.js$/,
2017-05-06 21:15:47 +01:00
loader: 'babel-loader',
exclude: /node_modules/,
},
2017-05-07 00:02:20 +01:00
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallback: "style-loader", use: "css-loader" }),
},
],
},
devtool: '#source-map',
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
2017-05-07 00:02:20 +01:00
new ExtractTextPlugin("style/[name].[hash:10].css"),
new StatsWriterPlugin({
fields: ['assets'],
filename: 'manifest.json',
transform(stats) {
const manifest = {};
stats.assets.map(asset => asset.name)
.sort()
.forEach((file) => {
manifest[file.replace(/\.[a-f0-9]{10}\./, '.')] = file;
});
return JSON.stringify(manifest, null, 2) + '\n';
}
}),
],
};