Skip to content

Instantly share code, notes, and snippets.

@zacck-zz
Created December 16, 2016 12:17
Show Gist options
  • Select an option

  • Save zacck-zz/d3e17ee1ce6058dc6bb43d83d4e86367 to your computer and use it in GitHub Desktop.

Select an option

Save zacck-zz/d3e17ee1ce6058dc6bb43d83d4e86367 to your computer and use it in GitHub Desktop.
var webpack = require('webpack');
var path = require('path');
var OfflinePlugin = require('offline-plugin');
module.exports = {
//find this file and start from there
entry: [
'script!jquery/dist/jquery.min.js',
'script!foundation-sites/dist/foundation.min.js',
'./app/app.jsx'
],
externals: {
jquery: 'jQuery'
},
plugins: [
new webpack.ProvidePlugin({
'$':'jquery',
'jQuery':'jquery'
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
})
],
output: {
path: __dirname,
filename: './public/bundle.js'
},
resolve: {
//where all this needs to happen
root: __dirname,
modulesDirectories: [
'node_modules',
'./app/components'
],
alias: {
applicationStyles: 'app/styles/app.scss',
},
//files we want to process
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
//name of loader
loader: 'babel-loader',
query: { //parse the files through react
presets: ['react', 'es2015', 'stage-0']
},
test: /\.jsx?$/, //regex for .jsx extension
exclude: /(node_modules|bower_components)/ //set up folders to be ignored
},
{
test: /\.(png|jpg|jpeg|gif|woff)$/,
loader: 'url-loader'
},
]
},
sassLoader: {
includePaths: [
path.resolve(__dirname, './node_modules/foundation-sites/scss'),
path.resolve(__dirname, "./node_modules/compass-mixins/lib")
]
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment