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 path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin"); var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require("webpack"); var webpack = require('webpack');
module.exports = { module.exports = {
entry: { entry: {
app: './js/main.js' app: './js/main.js'
@ -21,7 +21,7 @@ module.exports = {
{ {
test: /\.css$/, test: /\.css$/,
use: ExtractTextPlugin.extract({ use: ExtractTextPlugin.extract({
fallback: "style-loader", fallback: 'style-loader',
use: 'css-loader?importLoaders=1!postcss-loader' use: 'css-loader?importLoaders=1!postcss-loader'
}) })
} }
@ -29,22 +29,27 @@ module.exports = {
}, },
output: { output: {
path: path.join(__dirname, "./../static/dist"), path: path.join(__dirname, './../static/dist'),
filename: '[name].bundle.js', filename: '[name].[chunkhash].js'
}, },
resolve: { resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'], modules: [path.resolve(__dirname, 'src'), 'node_modules']
}, },
plugins: [ plugins: [
new ExtractTextPlugin("main.css"), new ExtractTextPlugin({
new webpack.ProvidePlugin({ filename: getPath => {
$: "jquery", return getPath('[name].[contenthash].css');
jQuery: "jquery" },
allChunks: true
}) })
// new webpack.ProvidePlugin({
// $: "jquery",
// jQuery: "jquery"
// })
], ],
watchOptions: { watchOptions: {
watch: true watch: true
} }
} };