Browse Source

Hash assets

Fixes #60
enhancements
budparr 6 years ago
parent
commit
75bde5d095
No account linked to committer's email address

+ 28
- 23
src/webpack.config.js View File

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 = { module.exports = {
entry: { entry: {
app: './js/main.js' app: './js/main.js'
module: { module: {
rules: [ 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$/, 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'
}) })
} }
}, },


output: { output: {
path: path.join(__dirname, "./../static/dist"),
filename: '[name].bundle.js',
path: path.join(__dirname, './../static/dist'),
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 webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
new ExtractTextPlugin({
filename: getPath => {
return getPath('[name].[contenthash].css');
},
allChunks: true
})
// new webpack.ProvidePlugin({
// $: "jquery",
// jQuery: "jquery"
// })
], ],
watchOptions: { watchOptions: {
watch: true watch: true
} }
}
};

static/dist/main.css → static/dist/app.4820926d6a88a9adbe776b0b5c678846.css View File


static/dist/app.bundle.js → static/dist/app.fab48d8a2f2e6b5fd864.js View File


Loading…
Cancel
Save