Skip to content

Instantly share code, notes, and snippets.

@hcharley
Created April 6, 2017 00:02
Show Gist options
  • Save hcharley/26889ad210cbd9c84661c64f70d77b54 to your computer and use it in GitHub Desktop.
Save hcharley/26889ad210cbd9c84661c64f70d77b54 to your computer and use it in GitHub Desktop.
var webpack = require('webpack');
var path = require('path');
var DashboardPlugin = require('webpack-dashboard/plugin');
var LiveReloadPlugin = require('webpack-livereload-plugin');
var STATIC_DIR = path.resolve(
__dirname,
'path/to/my/static/files/'
),
BUILD_DIR = path.join(STATIC_DIR, '/dist_js/'),
SRC_DIR = path.join(STATIC_DIR, '/js/');
var config = {
target: 'web',
entry: {
app: SRC_DIR + 'main.js',
},
output: {
path: BUILD_DIR,
filename: '[name].js'
},
resolve: {
modules: [ SRC_DIR, 'node_modules' ],
},
module: {
loaders: [
{
test: /\.js?/,
include: SRC_DIR,
loader: 'babel-loader',
query: { 'presets': [ 'es2015' ] }
},
{ test: /\.html?/, include: SRC_DIR, use: 'raw-loader' },
{ test: /\.css$/, use: [ 'style-loader', 'css-loader' ] },
{ test: /\.scss$/, use: [ 'style-loader', 'css-loader', 'sass-loader' ] },
{
test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.eot$|\.ttf$/,
loader: 'url-loader'
},
]
},
plugins: [
new webpack.ProvidePlugin({ jQuery: 'jquery', $: 'jquery' }),
new DashboardPlugin(),
new LiveReloadPlugin()
]
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment