Created
November 13, 2016 04:26
-
-
Save dburles/c22b6437e58ec4e4f5cf62a8e03e4d89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Backend config example | |
| // http://jlongster.com/Backend-Apps-with-Webpack--Part-I | |
| var path = require('path'); | |
| var webpack = require('webpack'); | |
| var fs = require('fs'); | |
| var nodeModules = {}; | |
| fs.readdirSync('node_modules') | |
| .filter(function(x) { | |
| return ['.bin'].indexOf(x) === -1; | |
| }) | |
| .forEach(function(mod) { | |
| nodeModules[mod] = 'commonjs ' + mod; | |
| }); | |
| module.exports = { | |
| target: 'node', | |
| entry: './src/index.js', | |
| output: { | |
| path: path.join(__dirname, 'dist'), | |
| filename: 'bundle.js' | |
| }, | |
| module: { | |
| loaders: [ | |
| { | |
| test: /\.js$/, | |
| exclude: /(node_modules)/, | |
| loader: 'babel', | |
| query: { | |
| presets: ['es2015'] | |
| } | |
| }, | |
| { | |
| test: /\.json$/, | |
| loader: 'json-loader' | |
| } | |
| ] | |
| }, | |
| externals: nodeModules | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment