Hash assets

Fixes #60
This commit is contained in:
budparr 2018-04-09 11:47:30 -04:00
parent 1b62e7bf1b
commit 75bde5d095
No known key found for this signature in database
GPG Key ID: 05AB7813F9C39728
3 changed files with 28 additions and 23 deletions

View File

@ -1,6 +1,6 @@
var path = require("path");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require("webpack");
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require('webpack');
module.exports = {
entry: {
app: './js/main.js'
@ -8,20 +8,20 @@ module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
// plugins: [require('babel-plugin-transform-object-rest-spread')]
}
}
},
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
// plugins: [require('babel-plugin-transform-object-rest-spread')]
}
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
fallback: 'style-loader',
use: 'css-loader?importLoaders=1!postcss-loader'
})
}
@ -29,22 +29,27 @@ module.exports = {
},
output: {
path: path.join(__dirname, "./../static/dist"),
filename: '[name].bundle.js',
path: path.join(__dirname, './../static/dist'),
filename: '[name].[chunkhash].js'
},
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
modules: [path.resolve(__dirname, 'src'), 'node_modules']
},
plugins: [
new ExtractTextPlugin("main.css"),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
new ExtractTextPlugin({
filename: getPath => {
return getPath('[name].[contenthash].css');
},
allChunks: true
})
// new webpack.ProvidePlugin({
// $: "jquery",
// jQuery: "jquery"
// })
],
watchOptions: {
watch: true
}
}
};