From 1f3b6f5598433ee8a565310915a75db4facc48f9 Mon Sep 17 00:00:00 2001
From: Bud Parr <budparr@gmail.com>
Date: Mon, 09 Apr 2018 16:33:10 +0000
Subject: [PATCH] Pre-2.0 Enhancements (#94)
---
src/webpack.config.js | 51 ++++++++++++++++++++++++++++-----------------------
1 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/webpack.config.js b/src/webpack.config.js
index 284cbcb..04da73f 100644
--- a/src/webpack.config.js
+++ b/src/webpack.config.js
@@ -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: {
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 @@
},
output: {
- path: path.join(__dirname, "./../static/dist"),
- filename: '[name].bundle.js',
+ path: path.join(__dirname, './../static/dist'),
+ filename: 'js/[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('css/[name].[contenthash].css');
+ },
+ allChunks: true
+ })
+ // new webpack.ProvidePlugin({
+ // $: "jquery",
+ // jQuery: "jquery"
+ // })
],
watchOptions: {
watch: true
}
-}
+};
--
Gitblit v1.10.0