Skip to content

Instantly share code, notes, and snippets.

@heygema
Last active March 28, 2017 23:26
Show Gist options
  • Save heygema/553766e8d3e9cd9e442a1f9ca7930068 to your computer and use it in GitHub Desktop.
Save heygema/553766e8d3e9cd9e442a1f9ca7930068 to your computer and use it in GitHub Desktop.
My webpack default config setup for django project.
{
"name": "myApp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"materialize-css": "^0.98.0"
},
"devDependencies": {
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"babel-preset-env": "^1.2.2",
"css-loader": "^0.27.3",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.10.1",
"path": "^0.12.7",
"style-loader": "^0.15.0",
"url-loader": "^0.5.8",
"webpack": "^2.2.1",
"webpack-bundle-tracker": "^0.2.0",
"webpack-dev-server": "^2.4.2"
}
}
var path = require("path");
var webpack = require("webpack");
var BundleTracker = require("webpack-bundle-tracker");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: [
'./static/app.js'
],
output: {
path: __dirname + '/static/bundles/',
filename: 'app.min.js',
},
module: {
loaders: [
{
test: /\.js$/, exclude: /node_modules/,
loader: "babel-loader",
query:{
'presets':['babel-preset-env']
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader',
'image-webpack-loader',
]
},
]
},
plugins: [
new BundleTracker({
filename:'./webpack-stats.json'
}),
new ExtractTextPlugin("app.min.css")
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment